about summary refs log tree commit diff
path: root/pkgs/applications/window-managers/i3/lock-fancy.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/window-managers/i3/lock-fancy.nix')
-rw-r--r--pkgs/applications/window-managers/i3/lock-fancy.nix59
1 files changed, 36 insertions, 23 deletions
diff --git a/pkgs/applications/window-managers/i3/lock-fancy.nix b/pkgs/applications/window-managers/i3/lock-fancy.nix
index f3963b43b54af..a66e52bc40b0d 100644
--- a/pkgs/applications/window-managers/i3/lock-fancy.nix
+++ b/pkgs/applications/window-managers/i3/lock-fancy.nix
@@ -1,54 +1,67 @@
-{ lib
-, stdenv
+{ coreutils
 , fetchFromGitHub
-, coreutils
-, scrot
-, imagemagick
+, fontconfig
 , gawk
-, i3lock-color
 , getopt
-, fontconfig
+, i3lock-color
+, imagemagick
+, installShellFiles
+, lib
+, makeWrapper
+, scrot
+, stdenv
+
+, screenshotCommand ? ""
 }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation {
   pname = "i3lock-fancy";
-  version = "unstable-2018-11-25";
+  version = "unstable-2023-04-28";
 
   src = fetchFromGitHub {
     owner = "meskarune";
     repo = "i3lock-fancy";
-    rev = "7accfb2aa2f918d1a3ab975b860df1693d20a81a";
-    sha256 = "00lqsvz1knb8iqy8lnkn3sf4c2c4nzb0smky63qf48m8za5aw9b1";
+    rev = "55f5c30071403faf5ae4363a54b6d1f63876d5ce";
+    hash = "sha256-ISymKlxLE4/ChDiyjnavFx4T5hEVI62cCxYLWrWiHrg=";
   };
 
+  nativeBuildInputs = [
+    makeWrapper
+    installShellFiles
+  ];
+
   postPatch = ''
     sed -i i3lock-fancy \
-      -e "s|mktemp|${coreutils}/bin/mktemp|" \
-      -e "s|'rm -f |'${coreutils}/bin/rm -f |" \
-      -e "s|scrot -z |${scrot}/bin/scrot -z |" \
-      -e "s|convert |${imagemagick.out}/bin/convert |" \
-      -e "s|awk -F|${gawk}/bin/awk -F|" \
-      -e "s| awk | ${gawk}/bin/awk |" \
-      -e "s|i3lock -i |${i3lock-color}/bin/i3lock-color -i |" \
       -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"|' \
-      -e "s|getopt |${getopt}/bin/getopt |" \
-      -e "s|fc-match |${fontconfig.bin}/bin/fc-match |" \
-      -e "s|shot=(import -window root)|shot=(${scrot}/bin/scrot -z -o)|"
+      -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 = with maintainers; [ ];
+    maintainers = [ maintainers.reedrw ];
+    mainProgram = "i3lock-fancy";
     license = licenses.mit;
     platforms = platforms.linux;
   };