Install fixes: bootstrap-install.sh (curl one-liner), nix flags in script, mkDefault hostname, doc typos/verify

Made-with: Cursor
This commit is contained in:
DannyDannyDanny 2026-03-08 18:06:54 +01:00
parent adae5e49f8
commit 52d60b9ce0
4 changed files with 44 additions and 20 deletions

21
scripts/bootstrap-install.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
# Fetch with curl and run to install NixOS (clone + run nixos-server-install.sh).
# On the live system, run only:
# curl -sL https://raw.githubusercontent.com/DannyDannyDanny/dotfiles/server-installer-usb/scripts/bootstrap-install.sh | sudo bash
#
# Optional: REPO_URL=... BRANCH=... (default repo and server-installer-usb)
set -euo pipefail
REPO_URL="${REPO_URL:-https://github.com/DannyDannyDanny/dotfiles.git}"
BRANCH="${BRANCH:-server-installer-usb}"
DEST="/tmp/dotfiles"
INSTALL_SCRIPT="$DEST/scripts/nixos-server-install.sh"
if [[ ! -f "$INSTALL_SCRIPT" ]]; then
echo "Cloning $REPO_URL ($BRANCH) to $DEST..."
nix run --extra-experimental-features "nix-command flakes" nixpkgs#git -- clone --branch "$BRANCH" "$REPO_URL" "$DEST"
fi
cd "$DEST"
[[ "$EUID" -ne 0 ]] && exec sudo bash "$INSTALL_SCRIPT"
exec bash "$INSTALL_SCRIPT"

View file

@ -1,13 +1,13 @@
#!/usr/bin/env bash
#!/bin/bash
# Run on a NixOS minimal live system (or installer ISO) to install NixOS with
# disko (LUKS + root). Prompts for hostname and target disk; optionally use
# INSTALLER_SYSTEM_CONFIG_FILE for WiFi etc.
#
# Usage:
# Export FLAKE_REF (e.g. github:User/dotfiles or path:/path/to/dotfiles/nixos).
# Or run from repo root and use: FLAKE_REF=path:$(pwd)/nixos
# Usage (from repo root, e.g. /tmp/dotfiles):
# sudo ./scripts/nixos-server-install.sh
# # or: sudo FLAKE_REF=github:User/dotfiles ./scripts/nixos-server-install.sh
# If you see "command not found", use: sudo bash ./scripts/nixos-server-install.sh
#
# Optional: FLAKE_REF=github:User/dotfiles or path:/path/to/dotfiles/nixos
#
# Optional: INSTALLER_SYSTEM_CONFIG_FILE=/path/to/json with full --system-config
# (e.g. hostName + networking.wireless.networks). If unset, only hostname is passed.
@ -65,7 +65,8 @@ if [[ "${confirm,,}" != "y" && "${confirm,,}" != "yes" ]]; then
exit 0
fi
exec nix run github:nix-community/disko/latest#disko-install -- \
exec nix run --extra-experimental-features "nix-command flakes" \
github:nix-community/disko/latest#disko-install -- \
--flake "${FLAKE_REF}#server-install" \
--disk main "$disk" \
--system-config "$SYSTEM_CONFIG"