From 45ef70cc73540fbf9718cce5da65e2aa6e7ab2f7 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Tue, 12 Jul 2022 12:02:01 +0200 Subject: [PATCH] swayidle: remove unnecessary config wrapper --- .../services/swayidle/basic-configuration.nix | 98 +++++++++---------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/tests/modules/services/swayidle/basic-configuration.nix b/tests/modules/services/swayidle/basic-configuration.nix index 4ecc13089..caa06ae16 100644 --- a/tests/modules/services/swayidle/basic-configuration.nix +++ b/tests/modules/services/swayidle/basic-configuration.nix @@ -1,55 +1,53 @@ { config, pkgs, lib, ... }: { - config = { - services.swayidle = { - enable = true; - package = config.lib.test.mkStubPackage { }; - timeouts = [ - { - timeout = 50; - command = ''notify-send -t 10000 -- "Screen lock in 10 seconds"''; - } - { - timeout = 60; - command = "swaylock -fF"; - } - { - timeout = 300; - command = ''swaymsg "output * dpms off"''; - resumeCommand = ''swaymsg "output * dpms on"''; - } - ]; - events = [ - { - event = "before-sleep"; - command = "swaylock -fF"; - } - { - event = "lock"; - command = "swaylock -fF"; - } - ]; - }; - - nmt.script = let - escapeForRegex = builtins.replaceStrings [ "'" "*" ] [ "'\\''" "\\*" ]; - expectedArgs = escapeForRegex (lib.concatStringsSep " " [ - "-w" - "timeout 50 'notify-send -t 10000 -- \"Screen lock in 10 seconds\"'" - "timeout 60 'swaylock -fF'" - "timeout 300 'swaymsg \"output * dpms off\"' resume 'swaymsg \"output * dpms on\"'" - "before-sleep 'swaylock -fF'" - "lock 'swaylock -fF'" - ]); - in '' - serviceFile=home-files/.config/systemd/user/swayidle.service - - assertFileExists $serviceFile - assertFileRegex $serviceFile 'ExecStart=.*/bin/swayidle ${expectedArgs}' - assertFileRegex $serviceFile 'Environment=.*PATH=${ - lib.makeBinPath [ pkgs.bash ] - }' - ''; + services.swayidle = { + enable = true; + package = config.lib.test.mkStubPackage { }; + timeouts = [ + { + timeout = 50; + command = ''notify-send -t 10000 -- "Screen lock in 10 seconds"''; + } + { + timeout = 60; + command = "swaylock -fF"; + } + { + timeout = 300; + command = ''swaymsg "output * dpms off"''; + resumeCommand = ''swaymsg "output * dpms on"''; + } + ]; + events = [ + { + event = "before-sleep"; + command = "swaylock -fF"; + } + { + event = "lock"; + command = "swaylock -fF"; + } + ]; }; + + nmt.script = let + escapeForRegex = builtins.replaceStrings [ "'" "*" ] [ "'\\''" "\\*" ]; + expectedArgs = escapeForRegex (lib.concatStringsSep " " [ + "-w" + "timeout 50 'notify-send -t 10000 -- \"Screen lock in 10 seconds\"'" + "timeout 60 'swaylock -fF'" + "timeout 300 'swaymsg \"output * dpms off\"' resume 'swaymsg \"output * dpms on\"'" + "before-sleep 'swaylock -fF'" + "lock 'swaylock -fF'" + ]); + in '' + serviceFile=home-files/.config/systemd/user/swayidle.service + + assertFileExists $serviceFile + assertFileRegex $serviceFile 'ExecStart=.*/bin/swayidle ${expectedArgs}' + assertFileRegex $serviceFile 'Environment=.*PATH=${ + lib.makeBinPath [ pkgs.bash ] + }' + ''; }