diff options
| author | Quentin Aristote <quentin@aristote.fr> | 2021-08-06 18:51:59 +0200 |
|---|---|---|
| committer | Quentin Aristote <quentin@aristote.fr> | 2021-08-06 18:51:59 +0200 |
| commit | a1f7f43c95c049628e826856ec589b339cd4f5db (patch) | |
| tree | a0f5bb10fc36f02ad6dbaebf1232ca2548f9ccfa /home/pkgs/lockscreen/default.nix | |
initial commit
Diffstat (limited to 'home/pkgs/lockscreen/default.nix')
| -rw-r--r-- | home/pkgs/lockscreen/default.nix | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/home/pkgs/lockscreen/default.nix b/home/pkgs/lockscreen/default.nix new file mode 100644 index 0000000..b36b08b --- /dev/null +++ b/home/pkgs/lockscreen/default.nix @@ -0,0 +1,37 @@ +{ pkgs, backgroundImage ? null, resolution ? "1920x1080" }: + +let useBackgroundImage = backgroundImage != null; +in pkgs.runCommand "lockscreen" { + buildInputs = with pkgs; + [ + # xorg.xdpyinfo + ]; + envVariable = true; +} ('' + mkdir -p $out/{bin,share} +'' + (if useBackgroundImage then '' + ${pkgs.imagemagick}/bin/convert ${backgroundImage} -resize ${resolution} -blur 0x5 RGB:$out/share/lockscreen.png +'' else + "") + '' + echo > $out/bin/lockscreen.sh \ + "export PATH=$PATH + ${pkgs.i3lock-color}/bin/i3lock-color \\ + '' + (if useBackgroundImage then '' + --raw ${resolution}:rgb \\ + --image $out/share/lockscreen.png \\ + '' else + "") + '' + --no-unlock-indicator \\ + --composite \\ + --clock \\ + --ignore-empty-password \\ + --time-color=FFFFFFFF \\ + --date-color=00000000 \\ + --time-size=100" + '' + (if useBackgroundImage then '' + chmod 444 $out/share/lockscreen.png + '' else + "") + '' + chmod 555 $out/bin/lockscreen.sh + chmod 555 $out/{bin,share} + '') |
