add ssh stuff to persistent

This commit is contained in:
Julien Malka 2024-04-07 11:52:35 +02:00
parent 32e78a8423
commit 941dc4fc23
Signed by: Luj
GPG key ID: 6FC74C847011FD83

View file

@ -24,6 +24,14 @@ pkgs.writeShellScriptBin "bootstrap-machine" ''
# Set the correct permissions so sshd will accept the key
chmod 600 "$temp/etc/ssh/ssh_host_ed25519_key"
ssh-keygen -f "$temp/etc/ssh/ssh_host_ed25519_key" -y > "$temp/etc/ssh/ssh_host_ed25519_key.pub"
chmod 644 "$temp/etc/ssh/ssh_host_ed25519_key.pub"
mkdir -p "$temp/persistent"
cp -r "$temp/ssh" "$temp/persistent/ssh"
nixos-anywhere --extra-files "$temp" --store-paths $(nix-build -A nixosConfigurations.\"$machine\".config.system.build.diskoScript) $(nix-build -A nixosConfigurations.\"$machine\".config.system.build.toplevel) "''${extra_args[@]}" root@"$ip"
popd
''