summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2022-04-14 10:15:28 +0200
committerGitHub <noreply@github.com>2022-04-14 10:15:28 +0200
commitcb1624c130ab1e97e1b39a5e9bf71f9483e800ac (patch)
treebe3e5f9c39c10b850b9f37538cd2991645b7d77d /nixos/tests
parent6025530db8413ff10c4fa56690aba17f141639da (diff)
parentaeb75b3b694850cb93866d417661081014e09279 (diff)
downloadnixpkgs-cb1624c130ab1e97e1b39a5e9bf71f9483e800ac.tar
nixpkgs-cb1624c130ab1e97e1b39a5e9bf71f9483e800ac.tar.gz
nixpkgs-cb1624c130ab1e97e1b39a5e9bf71f9483e800ac.tar.bz2
nixpkgs-cb1624c130ab1e97e1b39a5e9bf71f9483e800ac.tar.lz
nixpkgs-cb1624c130ab1e97e1b39a5e9bf71f9483e800ac.tar.xz
nixpkgs-cb1624c130ab1e97e1b39a5e9bf71f9483e800ac.tar.zst
nixpkgs-cb1624c130ab1e97e1b39a5e9bf71f9483e800ac.zip
Merge pull request #168477 from helsinki-systems/feat/systemd-stage-1-hibernation
nixos/stage-1-systemd: Implement and test hibernation
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/hibernate.nix6
2 files changed, 7 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index a1d4e284657..56629ad7773 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -208,6 +208,7 @@ in
   # hibernation. This test happens to work on x86_64-linux but
   # not on other platforms.
   hibernate = handleTestOn ["x86_64-linux"] ./hibernate.nix {};
+  hibernate-systemd-stage-1 = handleTestOn ["x86_64-linux"] ./hibernate.nix { systemdStage1 = true; };
   hitch = handleTest ./hitch {};
   hledger-web = handleTest ./hledger-web.nix {};
   hocker-fetchdocker = handleTest ./hocker-fetchdocker {};
diff --git a/nixos/tests/hibernate.nix b/nixos/tests/hibernate.nix
index 032ac6527bc..7a4b331169a 100644
--- a/nixos/tests/hibernate.nix
+++ b/nixos/tests/hibernate.nix
@@ -3,6 +3,7 @@
 { system ? builtins.currentSystem
 , config ? {}
 , pkgs ? import ../.. { inherit system config; }
+, systemdStage1 ? false
 }:
 
 with import ../lib/testing-python.nix { inherit system pkgs; };
@@ -29,6 +30,11 @@ let
       "/".device = "/dev/vda2";
     };
     swapDevices = mkOverride 0 [ { device = "/dev/vda1"; } ];
+    boot.resumeDevice = mkIf systemdStage1 "/dev/vda1";
+    boot.initrd.systemd = mkIf systemdStage1 {
+      enable = true;
+      emergencyAccess = true;
+    };
   };
   installedSystem = (import ../lib/eval-config.nix {
     inherit system;