fork/home-manager
git clone https://git.julia.blue/fork/home-manager
45ef70cc
master
1{ config , pkgs , lib , ...} : 2 3{ 4services . swayidle = { 5enable = true ; 6package = config . lib . test . mkStubPackage { }; 7timeouts = [ 8{ 9timeout = 50 ; 10command = ''notify-send -t 10000 -- "Screen lock in 10 seconds"'' ; 11} 12{ 13timeout = 60 ; 14command = "swaylock -fF" ; 15} 16{ 17timeout = 300 ; 18command = ''swaymsg "output * dpms off"'' ; 19resumeCommand = ''swaymsg "output * dpms on"'' ; 20} 21]; 22events = [ 23{ 24event = "before-sleep" ; 25command = "swaylock -fF" ; 26} 27{ 28event = "lock" ; 29command = "swaylock -fF" ; 30} 31]; 32}; 33 34nmt . script = let 35escapeForRegex = builtins . replaceStrings [ "'" "*" ] [ "'\\''" "\\*" ]; 36expectedArgs = escapeForRegex ( lib . concatStringsSep " " [ 37"-w" 38"timeout 50 'notify-send -t 10000 -- \"Screen lock in 10 seconds\"'" 39"timeout 60 'swaylock -fF'" 40"timeout 300 'swaymsg \"output * dpms off\"' resume 'swaymsg \"output * dpms on\"'" 41"before-sleep 'swaylock -fF'" 42"lock 'swaylock -fF'" 43]); 44in '' 45serviceFile=home-files/.config/systemd/user/swayidle.service 46 47assertFileExists $serviceFile 48assertFileRegex $serviceFile 'ExecStart=.*/bin/swayidle ${ expectedArgs } ' 49assertFileRegex $serviceFile 'Environment=.*PATH= ${ 50lib . makeBinPath [ pkgs . bash ] 51} ' 52'' ; 53}