fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert Helgessonswayidle: remove unnecessary config wrapper45ef70cc

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