diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix index 398ad8de19cf..2ae07e5bb5ba 100644 --- a/nixos/tests/installer.nix +++ b/nixos/tests/installer.nix @@ -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")