summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2019-05-12 03:22:29 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2019-05-12 03:22:29 +0200
commitd27431b362d8ad3d745989299d52640e4ce9863e (patch)
tree496e901f4e4694ee1e7a6c56609e0db4e135c5cd
parent775146165d0161210414566e28e18e3ac021f036 (diff)
downloadnixpkgs-d27431b362d8ad3d745989299d52640e4ce9863e.tar
nixpkgs-d27431b362d8ad3d745989299d52640e4ce9863e.tar.gz
nixpkgs-d27431b362d8ad3d745989299d52640e4ce9863e.tar.bz2
nixpkgs-d27431b362d8ad3d745989299d52640e4ce9863e.tar.lz
nixpkgs-d27431b362d8ad3d745989299d52640e4ce9863e.tar.xz
nixpkgs-d27431b362d8ad3d745989299d52640e4ce9863e.tar.zst
nixpkgs-d27431b362d8ad3d745989299d52640e4ce9863e.zip
nixos/xss-lock: add testcase for `lockerCommand` with several CLI options.
-rw-r--r--nixos/tests/xss-lock.nix36
1 files changed, 26 insertions, 10 deletions
diff --git a/nixos/tests/xss-lock.nix b/nixos/tests/xss-lock.nix
index b46bb1a8f6e..0d757e8cef3 100644
--- a/nixos/tests/xss-lock.nix
+++ b/nixos/tests/xss-lock.nix
@@ -6,19 +6,35 @@ with lib;
   name = "xss-lock";
   meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ma27 ];
 
-  machine = {
-    imports = [ ./common/x11.nix ./common/user-account.nix ];
-    programs.xss-lock.enable = true;
-    services.xserver.displayManager.auto.user = "alice";
+  nodes = {
+    simple = {
+      imports = [ ./common/x11.nix ./common/user-account.nix ];
+      programs.xss-lock.enable = true;
+      services.xserver.displayManager.auto.user = "alice";
+    };
+
+    custom_lockcmd = { pkgs, ... }: {
+      imports = [ ./common/x11.nix ./common/user-account.nix ];
+      services.xserver.displayManager.auto.user = "alice";
+
+      programs.xss-lock = {
+        enable = true;
+        extraOptions = [ "-n" "${pkgs.libnotify}/bin/notify-send 'About to sleep!'"];
+        lockerCommand = "${pkgs.xlockmore}/bin/xlock -mode ant";
+      };
+    };
   };
 
   testScript = ''
-    $machine->start;
-    $machine->waitForX;
-    $machine->waitForUnit("xss-lock.service", "alice");
+    startAll;
 
-    $machine->fail("pgrep xlock");
-    $machine->succeed("su -l alice -c 'xset dpms force standby'");
-    $machine->waitUntilSucceeds("pgrep i3lock");
+    ${concatStringsSep "\n" (mapAttrsToList (name: lockCmd: ''
+      ${"$"+name}->start;
+      ${"$"+name}->waitForX;
+      ${"$"+name}->waitForUnit("xss-lock.service", "alice");
+      ${"$"+name}->fail("pgrep ${lockCmd}");
+      ${"$"+name}->succeed("su -l alice -c 'xset dpms force standby'");
+      ${"$"+name}->waitUntilSucceeds("pgrep ${lockCmd}");
+    '') { simple = "i3lock"; custom_lockcmd = "xlock"; })}
   '';
 })