-
-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Use
identity_file
as deployment key
Will now use the provided `-i` (identity_file) as a stable deployment key - if specified - rather than always generating a random ephemeral SSH key. This is primarily useful for the following reasons: - error recovery - controlled phases *Error Recovery* If `nixos-anywhere` stops with an error, we might want to connect remotely to the deployed machine. With the ephemeral key this might not be possible, because we don't necessarily have access to it anymore. *Controlled Phases* It is already possible to control which phases should be run. With an ephemeral key outside our control we are not able to resume the phases with a second `nixos-anywhere` invocation, because a different deployment key will now be generated.
- Loading branch information
Showing
4 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
(import ./lib/test-base.nix) { | ||
name = "from-nixos-separated-phases"; | ||
nodes = { | ||
installer = ./modules/installer.nix; | ||
installed = { | ||
services.openssh.enable = true; | ||
virtualisation.memorySize = 1024; | ||
|
||
users.users.nixos = { | ||
isNormalUser = true; | ||
openssh.authorizedKeys.keyFiles = [ ./modules/ssh-keys/ssh.pub ]; | ||
extraGroups = [ "wheel" ]; | ||
}; | ||
security.sudo.enable = true; | ||
security.sudo.wheelNeedsPassword = false; | ||
}; | ||
}; | ||
testScript = '' | ||
start_all() | ||
with subtest("Kexec Phase"): | ||
installer.succeed(""" | ||
nixos-anywhere \ | ||
-i /root/.ssh/install_key \ | ||
--debug \ | ||
--kexec /etc/nixos-anywhere/kexec-installer \ | ||
--phases kexec \ | ||
--store-paths /etc/nixos-anywhere/disko /etc/nixos-anywhere/system-to-install \ | ||
nixos@installed >&2 | ||
""") | ||
with subtest("Disko Phase"): | ||
output = installer.succeed(""" | ||
nixos-anywhere \ | ||
-i /root/.ssh/install_key \ | ||
--debug \ | ||
--phases disko \ | ||
--store-paths /etc/nixos-anywhere/disko /etc/nixos-anywhere/system-to-install \ | ||
installed >&2 | ||
""") | ||
with subtest("Install Phase"): | ||
installer.succeed(""" | ||
nixos-anywhere \ | ||
-i /root/.ssh/install_key \ | ||
--debug \ | ||
--phases install \ | ||
--store-paths /etc/nixos-anywhere/disko /etc/nixos-anywhere/system-to-install \ | ||
root@installed >&2 | ||
""") | ||
''; | ||
} |