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:
parent
adae5e49f8
commit
52d60b9ce0
4 changed files with 44 additions and 20 deletions
|
|
@ -81,27 +81,29 @@ If you skip this, use Ethernet on the live system or the graphical NixOS install
|
||||||
|
|
||||||
1. Boot the server from the USB.
|
1. Boot the server from the USB.
|
||||||
2. If you did not bake WiFi into the ISO, attach Ethernet or (on graphical installer) join Wi‑Fi so the machine has network.
|
2. If you did not bake WiFi into the ISO, attach Ethernet or (on graphical installer) join Wi‑Fi so the machine has network.
|
||||||
3. Clone this repo (or copy the install script onto the machine). For example:
|
3. Run **one** of the following (shortest first).
|
||||||
|
|
||||||
|
**Shortest — fetch and run (no clone step):**
|
||||||
|
Exact URL (watch for typos: **.com** not .con, **usb** not ush, **DannyDannyDanny** with three capital Ds):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
nix run --extra-experimental-features "nix-command flakes" nixpkgs#git -- clone https://github.com/USER/dotfiles.git /tmp/dotfiles
|
curl -sL https://raw.githubusercontent.com/DannyDannyDanny/dotfiles/server-installer-usb/scripts/bootstrap-install.sh | sudo bash
|
||||||
cd /tmp/dotfiles
|
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Run the install script (it will prompt for hostname and target disk):
|
If you see `bash: 404: command not found`, the URL was wrong or the branch doesn’t exist. Check the URL, or verify first: `curl -sL "THE_URL_ABOVE" | head -1` should show `#!/bin/bash`, not HTML.
|
||||||
|
|
||||||
|
To type less, create a [git.io](https://git.io) short link once (paste the raw URL above), then on the machine run: `curl -sL https://git.io/YOUR_CODE | sudo bash`.
|
||||||
|
|
||||||
|
**Alternative — clone then run** (if you prefer not to pipe curl to bash):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo ./scripts/nixos-server-install.sh
|
nix run --extra-experimental-features "nix-command flakes" nixpkgs#git -- clone https://github.com/USER/REPO.git /tmp/dotfiles && cd /tmp/dotfiles && git checkout server-installer-usb && sudo ./scripts/nixos-server-install.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
The script uses the flake from the current repo by default (`path:$(pwd)/nixos`). To use the flake from GitHub instead:
|
If you see `command not found` when running the script, use `sudo bash ./scripts/nixos-server-install.sh` instead of `sudo ./scripts/...`.
|
||||||
|
|
||||||
```bash
|
4. When prompted: enter **hostname** (e.g. `phantom-ship`), then **target disk** (default `/dev/sda`), then **y** to proceed. When disko creates the LUKS volume, enter your encryption passphrase.
|
||||||
sudo FLAKE_REF=github:USER/dotfiles ./scripts/nixos-server-install.sh
|
5. When the script finishes, remove the USB and reboot. The new NixOS system will have LUKS root and the hostname you chose.
|
||||||
```
|
|
||||||
|
|
||||||
5. When disko creates the LUKS volume, enter the encryption passphrase when prompted.
|
|
||||||
6. When the script finishes, remove the USB and reboot. The new NixOS system will have LUKS root and the hostname you chose.
|
|
||||||
|
|
||||||
## WiFi on the installed system (optional)
|
## WiFi on the installed system (optional)
|
||||||
|
|
||||||
|
|
@ -155,6 +157,6 @@ Adjust the flake path and `--system-config` (e.g. add WiFi) as needed.
|
||||||
| **From Linux** | Option B: `nix build .#installer-iso` in `nixos/`, then write `result/iso/*.iso` to USB. |
|
| **From Linux** | Option B: `nix build .#installer-iso` in `nixos/`, then write `result/iso/*.iso` to USB. |
|
||||||
| Optional live WiFi | (Custom ISO only) Add `installer-wifi.nix` (gitignored), include in flake, rebuild on Linux. |
|
| Optional live WiFi | (Custom ISO only) Add `installer-wifi.nix` (gitignored), include in flake, rebuild on Linux. |
|
||||||
| Boot | Boot server from USB |
|
| Boot | Boot server from USB |
|
||||||
| Install | Clone repo, run `sudo ./scripts/nixos-server-install.sh` (set `FLAKE_REF` if not from repo) |
|
| Install | On live system: `curl -sL https://raw.githubusercontent.com/.../server-installer-usb/scripts/bootstrap-install.sh | sudo bash` (or clone then `sudo ./scripts/nixos-server-install.sh`) |
|
||||||
| Optional installed WiFi | Set `INSTALLER_SYSTEM_CONFIG_FILE` to a JSON file with wireless config |
|
| Optional installed WiFi | Set `INSTALLER_SYSTEM_CONFIG_FILE` to a JSON file with wireless config |
|
||||||
| Reboot | Remove USB, reboot; set root password if needed, add SSH keys |
|
| Reboot | Remove USB, reboot; set root password if needed, add SSH keys |
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
networking.hostName = "nixos"; # Override with --system-config at install
|
networking.hostName = lib.mkDefault "nixos"; # Overridden by --system-config at install
|
||||||
networking.wireless.enable = true;
|
networking.wireless.enable = true;
|
||||||
# networks."SSID".psk set via --system-config or imperative.conf after boot
|
# networks."SSID".psk set via --system-config or imperative.conf after boot
|
||||||
|
|
||||||
|
|
|
||||||
21
scripts/bootstrap-install.sh
Executable file
21
scripts/bootstrap-install.sh
Executable 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"
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
# Run on a NixOS minimal live system (or installer ISO) to install NixOS with
|
# 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
|
# disko (LUKS + root). Prompts for hostname and target disk; optionally use
|
||||||
# INSTALLER_SYSTEM_CONFIG_FILE for WiFi etc.
|
# INSTALLER_SYSTEM_CONFIG_FILE for WiFi etc.
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage (from repo root, e.g. /tmp/dotfiles):
|
||||||
# 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
|
|
||||||
# sudo ./scripts/nixos-server-install.sh
|
# 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
|
# Optional: INSTALLER_SYSTEM_CONFIG_FILE=/path/to/json with full --system-config
|
||||||
# (e.g. hostName + networking.wireless.networks). If unset, only hostname is passed.
|
# (e.g. hostName + networking.wireless.networks). If unset, only hostname is passed.
|
||||||
|
|
@ -65,7 +65,8 @@ if [[ "${confirm,,}" != "y" && "${confirm,,}" != "yes" ]]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
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" \
|
--flake "${FLAKE_REF}#server-install" \
|
||||||
--disk main "$disk" \
|
--disk main "$disk" \
|
||||||
--system-config "$SYSTEM_CONFIG"
|
--system-config "$SYSTEM_CONFIG"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue