depot/third_party/nixpkgs/pkgs/applications/window-managers/i3/lock-fancy.nix
Default email 5c370c0b2a Project import generated by Copybara.
GitOrigin-RevId: 33d1e753c82ffc557b4a585c77de43d4c922ebb5
2024-05-15 17:35:15 +02:00

68 lines
1.8 KiB
Nix

{ coreutils
, fetchFromGitHub
, fontconfig
, gawk
, getopt
, i3lock-color
, imagemagick
, installShellFiles
, lib
, makeWrapper
, scrot
, stdenv
, screenshotCommand ? ""
}:
stdenv.mkDerivation {
pname = "i3lock-fancy";
version = "unstable-2023-04-28";
src = fetchFromGitHub {
owner = "meskarune";
repo = "i3lock-fancy";
rev = "55f5c30071403faf5ae4363a54b6d1f63876d5ce";
hash = "sha256-ISymKlxLE4/ChDiyjnavFx4T5hEVI62cCxYLWrWiHrg=";
};
nativeBuildInputs = [
makeWrapper
installShellFiles
];
postPatch = ''
sed -i i3lock-fancy \
-e 's|icon="/usr/share/i3lock-fancy/icons/lockdark.png"|icon="'$out'/share/i3lock-fancy/icons/lockdark.png"|' \
-e 's|icon="/usr/share/i3lock-fancy/icons/lock.png"|icon="'$out'/share/i3lock-fancy/icons/lock.png"|'
rm Makefile
'' + lib.optionalString (screenshotCommand != "") ''
sed -i i3lock-fancy \
-e "s|shot=(import -silent -window root)|shot=(${screenshotCommand})|";
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/share/i3lock-fancy/icons
cp i3lock-fancy $out/bin/i3lock-fancy
ln -s $out/bin/i3lock-fancy $out/bin/i3lock
cp icons/lock*.png $out/share/i3lock-fancy/icons
installManPage doc/i3lock-fancy.1
runHook postInstall
'';
postInstall = ''
wrapProgram $out/bin/i3lock-fancy \
--prefix PATH : ${lib.makeBinPath [ coreutils fontconfig gawk getopt i3lock-color imagemagick scrot ]}
'';
meta = with lib; {
description = "i3lock is a bash script that takes a screenshot of the desktop, blurs the background and adds a lock icon and text";
homepage = "https://github.com/meskarune/i3lock-fancy";
maintainers = [ maintainers.reedrw ];
mainProgram = "i3lock-fancy";
license = licenses.mit;
platforms = platforms.linux;
};
}