Merge pull request #168477 from helsinki-systems/feat/systemd-stage-1-hibernation
nixos/stage-1-systemd: Implement and test hibernation
This commit is contained in:
commit
cb1624c130
|
@ -59,7 +59,10 @@ let
|
||||||
${if config.boot.initrd.systemd.enable then ''
|
${if config.boot.initrd.systemd.enable then ''
|
||||||
cp ${config.system.build.bootStage2} $out/prepare-root
|
cp ${config.system.build.bootStage2} $out/prepare-root
|
||||||
substituteInPlace $out/prepare-root --subst-var-by systemConfig $out
|
substituteInPlace $out/prepare-root --subst-var-by systemConfig $out
|
||||||
ln -s "$systemd/lib/systemd/systemd" $out/init
|
# This must not be a symlink or the abs_path of the grub builder for the tests
|
||||||
|
# will resolve the symlink and we end up with a path that doesn't point to a
|
||||||
|
# system closure.
|
||||||
|
cp "$systemd/lib/systemd/systemd" $out/init
|
||||||
'' else ''
|
'' else ''
|
||||||
cp ${config.system.build.bootStage2} $out/init
|
cp ${config.system.build.bootStage2} $out/init
|
||||||
substituteInPlace $out/init --subst-var-by systemConfig $out
|
substituteInPlace $out/init --subst-var-by systemConfig $out
|
||||||
|
|
|
@ -503,5 +503,8 @@ in {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
boot.kernelParams = lib.mkIf (config.boot.resumeDevice != "") [ "resume=${config.boot.resumeDevice}" ];
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,6 +208,7 @@ in
|
||||||
# hibernation. This test happens to work on x86_64-linux but
|
# hibernation. This test happens to work on x86_64-linux but
|
||||||
# not on other platforms.
|
# not on other platforms.
|
||||||
hibernate = handleTestOn ["x86_64-linux"] ./hibernate.nix {};
|
hibernate = handleTestOn ["x86_64-linux"] ./hibernate.nix {};
|
||||||
|
hibernate-systemd-stage-1 = handleTestOn ["x86_64-linux"] ./hibernate.nix { systemdStage1 = true; };
|
||||||
hitch = handleTest ./hitch {};
|
hitch = handleTest ./hitch {};
|
||||||
hledger-web = handleTest ./hledger-web.nix {};
|
hledger-web = handleTest ./hledger-web.nix {};
|
||||||
hocker-fetchdocker = handleTest ./hocker-fetchdocker {};
|
hocker-fetchdocker = handleTest ./hocker-fetchdocker {};
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
{ system ? builtins.currentSystem
|
{ system ? builtins.currentSystem
|
||||||
, config ? {}
|
, config ? {}
|
||||||
, pkgs ? import ../.. { inherit system config; }
|
, pkgs ? import ../.. { inherit system config; }
|
||||||
|
, systemdStage1 ? false
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with import ../lib/testing-python.nix { inherit system pkgs; };
|
with import ../lib/testing-python.nix { inherit system pkgs; };
|
||||||
|
@ -29,6 +30,11 @@ let
|
||||||
"/".device = "/dev/vda2";
|
"/".device = "/dev/vda2";
|
||||||
};
|
};
|
||||||
swapDevices = mkOverride 0 [ { device = "/dev/vda1"; } ];
|
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 {
|
installedSystem = (import ../lib/eval-config.nix {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
|
Loading…
Reference in a new issue