diff --git a/.gitignore b/.gitignore index eed1b4d..6c112c0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ result /nix .DS_Store +hosts/*-hardware.nix +hosts/local-*.nix diff --git a/agents.md b/agents.md index c438683..9587cb5 100644 --- a/agents.md +++ b/agents.md @@ -296,3 +296,5 @@ If you want, next we can: - Network: DHCP on primary interface (e.g., `ensp1s0` in VM); SSH reachable once IP obtained. - Purpose: sandbox for validating flake changes before baking into the ISO. - Workflow: sync repo to VM and `nixos-rebuild switch --flake /etc/nixos#installer`; rebuild ISO **only on explicit request** (ISO must remain hardware-agnostic, no embedded host-specific files). +- Host-local files: the installer writes `hosts/local-.nix` and `hosts/local--hardware.nix` on the target. These are ignored by git. When syncing, exclude them to avoid deletion: + `rsync -a --exclude 'hosts/local-*.nix' --exclude 'hosts/*-hardware.nix' --exclude '.git' . admin@:/home/admin/nixos-sync` diff --git a/docs/install-help.txt b/docs/install-help.txt index a515de7..ddda7c8 100644 --- a/docs/install-help.txt +++ b/docs/install-help.txt @@ -11,7 +11,7 @@ Optionally set DISK and HOSTNAME (defaults: DISK=/dev/vda, HOSTNAME=nanuqsaurus) sudo DISK=/dev/vda HOSTNAME=nanuqsaurus /etc/nixos/scripts/install-btrfs.sh -The script wipes the whole disk, creates Btrfs subvolumes (root, home, nix), copies the flake, generates hardware config, and installs. +The script wipes the whole disk, creates Btrfs subvolumes (root, home, nix), copies the flake, generates hardware config, and installs. It writes host files under `/etc/nixos/hosts/local-.nix` and `local--hardware.nix` (kept local to the machine). If you need a more custom setup please run the partitioning manually, mount the target to /mnt and then install the system: diff --git a/scripts/install-btrfs.sh b/scripts/install-btrfs.sh index aa345ad..ee5ab45 100755 --- a/scripts/install-btrfs.sh +++ b/scripts/install-btrfs.sh @@ -44,9 +44,9 @@ fi echo "[6/7] Generating hardware config" mkdir -p /mnt/etc/nixos/hosts -nixos-generate-config --root /mnt --show-hardware-config > "/mnt/etc/nixos/hosts/${HOSTNAME}-hardware.nix" +nixos-generate-config --root /mnt --show-hardware-config > "/mnt/etc/nixos/hosts/local-${HOSTNAME}-hardware.nix" -host_file="/mnt/etc/nixos/hosts/${HOSTNAME}.nix" +host_file="/mnt/etc/nixos/hosts/local-${HOSTNAME}.nix" if [ ! -e "${host_file}" ]; then cat > "${host_file}" <