This commit is contained in:
Raphael Numbus
2025-12-06 22:36:56 +01:00
parent 0861355cdc
commit e2fa6093c8
+10 -8
View File
@@ -453,7 +453,7 @@ EOF
gum confirm "Proceed with this disk configuration?" || { echo " ❌ Aborting as requested."; exit 1; } gum confirm "Proceed with this disk configuration?" || { echo " ❌ Aborting as requested."; exit 1; }
# Final recap <-- # Final recap <--
echo -e "\n\n ⚙️ Generating disko configuration from templates..." echo -e "\n\n Generating disko configuration from templates..."
template_file="config-files/disks/boot-${NUMBER_OF_BOOT_DISKS}.nix" template_file="config-files/disks/boot-${NUMBER_OF_BOOT_DISKS}.nix"
(envsubst < "$template_file") > ./nix-config/disks/disko.nix (envsubst < "$template_file") > ./nix-config/disks/disko.nix
echo -e "\n ✅ Generated boot disk configuration." echo -e "\n ✅ Generated boot disk configuration."
@@ -474,13 +474,17 @@ EOF
done done
[[ "$NUMBER_OF_PARITY_DISKS" -gt 0 ]] && echo -e "\n ✅ Generated $NUMBER_OF_PARITY_DISKS parity disk configuration(s)." [[ "$NUMBER_OF_PARITY_DISKS" -gt 0 ]] && echo -e "\n ✅ Generated $NUMBER_OF_PARITY_DISKS parity disk configuration(s)."
# Close the disko imports block cat <<'EOF' >> ./nix-config/disks/disko.nix
echo '}' >> ./nix-config/disks/disko.nix };
echo -e "\n ✅ Final disko configuration created at './nix-config/disks/disko.nix'." };
}
EOF
echo -e "\n ✅ Final disko configuration created.
# --> Generate automatic unlock configuration in ./nix-config/disks/snapraid.nix # --> Generate automatic unlock configuration in ./nix-config/disks/snapraid.nix
if [[ "$NUMBER_OF_CONTENT_DISKS" -gt 0 || "$NUMBER_OF_PARITY_DISKS" -gt 0 ]]; then if [[ "$NUMBER_OF_CONTENT_DISKS" -gt 0 || "$NUMBER_OF_PARITY_DISKS" -gt 0 ]]; then
echo -e "\n ⚙️ Adding automatic disk unlocking configuration to './nix-config/disks/snapraid.nix'..." echo -e "\n\n Adding automatic disk unlocking configuration to './nix-config/disks/snapraid.nix'..."
sed -i '$ d' ./nix-config/disks/snapraid.nix sed -i '$ d' ./nix-config/disks/snapraid.nix
cat <<EOF >> ./nix-config/disks/snapraid.nix cat <<EOF >> ./nix-config/disks/snapraid.nix
@@ -512,8 +516,6 @@ EOF
}; };
} }
EOF EOF
echo -e "\n\n ✅ Automatic disks unlock configuration added."
fi fi
# Generate automatic unlock configuration in ./nix-config/disks/snapraid.nix <-- # Generate automatic unlock configuration in ./nix-config/disks/snapraid.nix <--
} }
@@ -522,7 +524,7 @@ deploy() {
echo -e "\n\n 🔄 Deploying to the remote server..." echo -e "\n\n 🔄 Deploying to the remote server..."
nix run github:nix-community/nixos-anywhere -- \ nix run github:nix-community/nixos-anywhere -- \
--generate-hardware-config nixos-generate-config ./nix-config/hardware-configuration.nix \ --generate-hardware-config nixos-generate-config ./nix-config/hardware-configuration.nix \
--flake ./nix-config/flake.nix#numbus-server \ --flake ./nix-config#numbus-server \
--extra-files extra-files \ --extra-files extra-files \
--chown "/home/numbus-admin/" 1000:1000 \ --chown "/home/numbus-admin/" 1000:1000 \
--target-host nixos@$TARGET_HOST --target-host nixos@$TARGET_HOST