Make custom swaylock wrapper own derivation

Hopefully fix issues with swayidle not being able to find wrapped
script by passing derivation directly
This commit is contained in:
Evie Litherland-Smith 2024-05-21 07:02:06 +01:00
parent 93d1867f5f
commit 8e7bc3aeaf
3 changed files with 19 additions and 5 deletions

View file

@ -1,11 +1,19 @@
{...}: { {
config,
pkgs,
...
}: {
imports = [../swaylock/default.nix]; imports = [../swaylock/default.nix];
services.swayidle = { services.swayidle = let
swaylockfx =
pkgs.callPackage ../swaylock/swaylockfx.nix
{swaylock-effects = config.programs.swaylock.package;};
in {
enable = true; enable = true;
timeouts = [ timeouts = [
{ {
timeout = 60 * 15; # 15 minutes timeout = 60 * 15; # 15 minutes
command = "swaylockfx"; command = "${swaylockfx}/bin/swaylockfx";
} }
]; ];
}; };

View file

@ -5,8 +5,8 @@
... ...
}: { }: {
home.packages = with pkgs; [ home.packages = with pkgs; [
(writeShellScriptBin "swaylockfx" (callPackage ./swaylockfx.nix
"${config.programs.swaylock.package}/bin/swaylock --screenshots --clock --indicator --grace-no-mouse") {swaylock-effects = config.programs.swaylock.package;})
]; ];
programs.swaylock = { programs.swaylock = {
enable = true; enable = true;

View file

@ -0,0 +1,6 @@
{
writeShellScriptBin,
swaylock-effects,
...
}:
writeShellScriptBin "swaylockfx" "${swaylock-effects}/bin/swaylock --screenshots --clock --indicator --grace-no-mouse"