mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-29 07:10:51 +01:00
improve bootstrap-machine script
This commit is contained in:
parent
3ee42a6bb1
commit
c697eaa7e9
1 changed files with 4 additions and 3 deletions
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Create a temporary directory
|
|
||||||
temp=$(mktemp -d)
|
|
||||||
machine=$1
|
machine=$1
|
||||||
ip=$2
|
ip=$2
|
||||||
|
extra_args=("${@:3}")
|
||||||
|
# Create a temporary directory
|
||||||
|
temp=$(mktemp -d)
|
||||||
# Function to cleanup temporary directory on exit
|
# Function to cleanup temporary directory on exit
|
||||||
cleanup() {
|
cleanup() {
|
||||||
rm -rf "$temp"
|
rm -rf "$temp"
|
||||||
|
@ -19,4 +20,4 @@ rbw get "$machine"_ssh_host_ed25519_key -f notes > "$temp/etc/ssh/ssh_host_ed255
|
||||||
# Set the correct permissions so sshd will accept the key
|
# Set the correct permissions so sshd will accept the key
|
||||||
chmod 600 "$temp/etc/ssh/ssh_host_ed25519_key"
|
chmod 600 "$temp/etc/ssh/ssh_host_ed25519_key"
|
||||||
|
|
||||||
nixos-anywhere --extra-files "$temp" --store-paths $(nix-build -A nixosConfigurations.\"$machine\".config.system.build.toplevel) $(nix-build -A nixosConfigurations.\"$machine\".config.system.build.diskoScript) root@"$ip"
|
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"
|
||||||
|
|
Loading…
Add table
Reference in a new issue