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:
parent
a5b7b6e47a
commit
19cfb3e48c
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue