Keep local host/hardware files, default hostname nanuqsaurus
This commit is contained in:
parent
91a4b180a4
commit
36fb3bd193
4 changed files with 8 additions and 4 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -2,3 +2,5 @@
|
|||
result
|
||||
/nix
|
||||
.DS_Store
|
||||
hosts/*-hardware.nix
|
||||
hosts/local-*.nix
|
||||
|
|
|
|||
|
|
@ -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-<hostname>.nix` and `hosts/local-<hostname>-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@<vm>:/home/admin/nixos-sync`
|
||||
|
|
|
|||
|
|
@ -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-<hostname>.nix` and `local-<hostname>-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:
|
||||
|
|
|
|||
|
|
@ -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}" <<EOF
|
||||
{ inputs, ... }:
|
||||
|
|
@ -57,7 +57,7 @@ if [ ! -e "${host_file}" ]; then
|
|||
../modules/system/base.nix
|
||||
../modules/desktop/gnome-minimal.nix
|
||||
../modules/users/admin.nix
|
||||
./${HOSTNAME}-hardware.nix
|
||||
./local-${HOSTNAME}-hardware.nix
|
||||
];
|
||||
|
||||
networking.hostName = "${HOSTNAME}";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue