1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 11:40:45 +00:00

nixos/tests/installer: test initrd secrets and nix-build

Both of those things rely on nixos-enter creating `/tmp` under the mount
point.
This commit is contained in:
Naïm Favier 2023-01-01 17:20:37 +01:00
parent a5b7b6e47a
commit 19cfb3e48c
No known key found for this signature in database
GPG key ID: 95AFCE8211908325

View file

@ -49,6 +49,8 @@ let
boot.loader.systemd-boot.enable = true;
''}
boot.initrd.secrets."/etc/secret" = /etc/nixos/secret;
users.users.alice = {
isNormalUser = true;
home = "/home/alice";
@ -124,6 +126,7 @@ let
}",
"/mnt/etc/nixos/configuration.nix",
)
machine.copy_from_host("${pkgs.writeText "secret" "secret"}", "/mnt/etc/nixos/secret")
with subtest("Perform the installation"):
machine.succeed("nixos-install < /dev/null >&2")
@ -131,6 +134,19 @@ let
with subtest("Do it again to make sure it's idempotent"):
machine.succeed("nixos-install < /dev/null >&2")
with subtest("Check that we can build things in nixos-enter"):
machine.succeed(
"""
nixos-enter -- nix-build --option substitute false -E 'derivation {
name = "t";
builder = "/bin/sh";
args = ["-c" "echo nixos-enter build > $out"];
system = builtins.currentSystem;
preferLocalBuild = true;
}'
"""
)
with subtest("Shutdown system after installation"):
machine.succeed("umount /mnt/boot || true")
machine.succeed("umount /mnt")