diff --git a/CLAUDE.md b/CLAUDE.md index f75beba..2fb3e6f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -130,10 +130,10 @@ removing a host. host be built as a standalone, `qm importdisk`-ready `.raw` image with no install step — see `docs/proxmox-images.md`. - `modules/boot/efi.nix` — systemd-boot + EFI vars, paired with the disko module. -- `modules/installer/` — the auto-installer environment (ISO/netboot/Proxmox - LXC): `common.nix` (shared config + the generated `auto-install.sh`), - `iso.nix`/`proxmox-lxc.nix` (per-variant), `host-keys.nix` (optionally - bakes `host-keys/` into the image under `--impure`). See +- `modules/installer/` — the auto-installer environment (ISO, also served as + PXE netboot): `common.nix` (shared config + the generated + `auto-install.sh`), `iso.nix`, `host-keys.nix` (optionally bakes + `host-keys/` into the image under `--impure`). See `docs/auto-installer.md`. - `modules/pxe-boot/stage-installer-artifacts.nix` — builds the installer's netboot image and stages it on the `pxe-boot` host so its iPXE menu can diff --git a/README.md b/README.md index 6265fd9..c1fb673 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ nix eval --json .#nixosConfigurations --apply builtins.attrNames | jq -r '.[]' | `modules/build-types/` | Build-type-specific config: what makes a system minimal/server/docker/gui/pxe-boot/nix-cache | | `modules/common/` | Shared NixOS config, Home Manager, aliases imported by every host | | `modules/nix-cache/` | Binary cache and remote builder client/server modules | -| `modules/installer/` | Auto-installer environment (ISO/netboot/Proxmox LXC) — see `docs/auto-installer.md` | +| `modules/installer/` | Auto-installer environment (ISO, also served as PXE netboot) — see `docs/auto-installer.md` | | `host-keys/` | Gitignored, locally-generated SSH host keys for the auto-installer — see `docs/auto-installer.md` | | `docs/` | Operational notes for cache, builders, lock updates, boot services, the auto-installer, and Proxmox image builds | | `scripts/` | Codex setup, validation, and host-key-prep helpers | diff --git a/docs/auto-installer.md b/docs/auto-installer.md index d3f8022..8cad6a8 100644 --- a/docs/auto-installer.md +++ b/docs/auto-installer.md @@ -5,8 +5,9 @@ install any host exposed by its own `nixosConfigurations`. It was migrated from a formerly-separate `nix-auto-installer` repo — everything it did now lives here. -The installer provides a small NixOS install environment (ISO/netboot/Proxmox -LXC) with SSH access, Git support, and an interactive installation script. +The installer provides a small NixOS install environment (ISO, or the same +image netbooted via PXE) with SSH access, Git support, and an interactive +installation script. Logging in as any user (root or `nixos`) runs `/etc/auto-install.sh`, discovers available hosts from this same flake, lets the operator choose a target, applies that host's Disko storage configuration, installs NixOS, and @@ -53,8 +54,6 @@ it does for the ISO/PXE installer images. `installation-cd-minimal.nix` module plus `common.nix`. Also used, paired with `netboot-minimal.nix`, to build the PXE netboot variant (see `docs/pxe-boot.md`). -- `modules/installer/proxmox-lxc.nix` — Proxmox LXC-specific: disables - bootloader options (containers don't need one) plus `common.nix`. - `modules/installer/host-keys.nix` — optionally bakes pre-generated SSH host keys into the image; see "Host keys" below. - `scripts/prepare-host-key.sh` — admin-workstation pre-flight tool, see @@ -63,22 +62,26 @@ it does for the ISO/PXE installer images. Flake outputs: ```nix -nixosConfigurations.installer # ISO/netboot installer image -nixosConfigurations.proxmox-lxc # Proxmox LXC-based installer image +nixosConfigurations.installer # ISO/netboot installer image packages.x86_64-linux.iso # installer ISO/netboot image -packages.x86_64-linux.lxc # Proxmox LXC installer tarball packages.x86_64-linux.pxe # netboot-ipxe + netboot-initrd + netboot-kernel, bundled -packages.x86_64-linux.all # all three of the above, bundled ``` ```sh nix build .#iso -nix build .#lxc nix build .#pxe -nix build .#all ``` +There's no `nixosConfigurations.proxmox-lxc` (installer-boots-as-an-LXC- +container) or `packages.x86_64-linux.lxc`/`.all` anymore. Both existed only +to let the installer itself run as an LXC container so you could +`nixos-install` some *other* host from within it — but LXC targets are +excluded from the install menu (same bind-mount problem as any LXC +`nixos-install`), and now have their own direct tarball path anyway (see +"LXC hosts" above), which left the installer's own LXC form with no real +use case. + The `pxe` variant is also built automatically as part of the `pxe-boot` host itself (`modules/pxe-boot/stage-installer-artifacts.nix`) and served over iPXE — see `docs/pxe-boot.md`. diff --git a/flake.nix b/flake.nix index 9548ef7..9a0c8af 100644 --- a/flake.nix +++ b/flake.nix @@ -100,12 +100,6 @@ modules = [ ./modules/installer/iso.nix ]; specialArgs = { inherit vars; }; }; - - proxmox-lxc = nixpkgs.lib.nixosSystem { - inherit system; - modules = [ ./modules/installer/proxmox-lxc.nix ]; - specialArgs = { inherit vars; }; - }; }; # Same installer environment, built as netboot (kernel + initrd + @@ -128,24 +122,22 @@ nixosConfigurations = generatedTargets // installerTargets; - # Buildable auto-installer artifacts (`nix build .#`), migrated - # unchanged from nix-auto-installer's interface. - packages.${system} = rec { + # Buildable auto-installer artifacts (`nix build .#`). No `lxc` + # variant (installer-boots-as-an-LXC-container) or `all` bundle + # anymore — lxc-* and proxmox-* hosts deploy via their own tarball/ + # disk-image outputs instead (see docs/auto-installer.md and + # docs/proxmox-images.md), which left the installer's own LXC form + # with no real use case: it's excluded from the install menu (same + # bind-mount problem as any LXC nixos-install target) and nothing + # else needed booting the installer itself as a container. + packages.${system} = { iso = installerTargets.installer.config.system.build.isoImage; - lxc = installerTargets.proxmox-lxc.config.system.build.tarball; - pxe = pkgs.linkFarm "pxe" [ { name = "netboot.ipxe"; path = netbootSystem.config.system.build.netbootIpxeScript; } { name = "initrd"; path = netbootSystem.config.system.build.netbootRamdisk; } { name = "kernel"; path = netbootSystem.config.system.build.kernel; } ]; - - all = pkgs.linkFarm "all" [ - { name = "iso"; path = iso; } - { name = "lxc"; path = lxc; } - { name = "pxe"; path = pxe; } - ]; }; }; } diff --git a/modules/installer/common.nix b/modules/installer/common.nix index e7e1667..fde1ee0 100644 --- a/modules/installer/common.nix +++ b/modules/installer/common.nix @@ -57,25 +57,23 @@ echo "Fetching available NixOS hosts from flake..." # Two categories deliberately excluded from the menu: - # lxc-* — these build a config.system.build.tarball - # meant for `pct restore` on Proxmox - # directly, not an install. Running - # nixos-install against one here would - # bind-mount / onto /mnt and then refuse to - # touch the filesystem it's currently - # running on — see docs/auto-installer.md. - # installer/proxmox-lxc — these *are* the installer image's own - # flake targets, not deployable hosts; - # "installing" one means nixos-install-ing - # a copy of the installer into itself. + # lxc-* — these build a config.system.build.tarball meant for + # `pct restore` on Proxmox directly, not an install. + # Running nixos-install against one here would + # bind-mount / onto /mnt and then refuse to touch the + # filesystem it's currently running on — see + # docs/auto-installer.md. + # installer — this *is* the installer image's own flake target, + # not a deployable host; "installing" it means + # nixos-install-ing a copy of the installer into + # itself. mapfile -t options < <( nix eval --json --no-use-registries --no-accept-flake-config --extra-experimental-features "flakes nix-command" \ "''${FLAKE_BASE_URL}#nixosConfigurations" \ --apply builtins.attrNames \ | jq -r '.[] | select(startswith("lxc-") | not) - | select(. != "installer") - | select(. != "proxmox-lxc")' + | select(. != "installer")' ) if [[ ''${#options[@]} -eq 0 ]]; then diff --git a/modules/installer/proxmox-lxc.nix b/modules/installer/proxmox-lxc.nix deleted file mode 100644 index 887c97f..0000000 --- a/modules/installer/proxmox-lxc.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ modulesPath, ... }: - -{ - imports = [ - ./common.nix - (modulesPath + "/virtualisation/proxmox-lxc.nix") - ]; - - # LXC has no bootloader - boot.loader.grub.enable = false; - boot.loader.systemd-boot.enable = false; -} diff --git a/scripts/codex-maintenance.sh b/scripts/codex-maintenance.sh index f8e556d..5518e78 100755 --- a/scripts/codex-maintenance.sh +++ b/scripts/codex-maintenance.sh @@ -57,9 +57,8 @@ for host in $hosts; do nix eval --raw --no-use-registries --no-accept-flake-config ".#nixosConfigurations.${host}.config.system.build.toplevel.drvPath" # lxc-* hosts deploy via a directly pct-restore-able tarball instead of - # nixos-install (see docs/auto-installer.md); proxmox-* hosts (excluding - # proxmox-lxc, the installer's own LXC target, which has no disko config) - # can alternatively be built as a standalone disk image (see + # nixos-install (see docs/auto-installer.md); proxmox-* hosts can + # alternatively be built as a standalone disk image (see # docs/proxmox-images.md). Both are otherwise-unvalidated buildable # surface, easy to silently break without this. case "$host" in @@ -67,7 +66,6 @@ for host in $hosts; do echo "==> $host (tarball)" nix eval --raw --no-use-registries --no-accept-flake-config ".#nixosConfigurations.${host}.config.system.build.tarball.drvPath" ;; - proxmox-lxc) ;; proxmox-*) echo "==> $host (diskoImagesScript)" nix eval --raw --no-use-registries --no-accept-flake-config ".#nixosConfigurations.${host}.config.system.build.diskoImagesScript.drvPath" @@ -96,7 +94,6 @@ if [[ "$MODE" == "dry-run" ]]; then echo "==> Dry-run build: $host (tarball)" nix build --dry-run --no-link --no-use-registries --no-accept-flake-config ".#nixosConfigurations.${host}.config.system.build.tarball" ;; - proxmox-lxc) ;; proxmox-*) echo "==> Dry-run build: $host (diskoImagesScript)" nix build --dry-run --no-link --no-use-registries --no-accept-flake-config ".#nixosConfigurations.${host}.config.system.build.diskoImagesScript" diff --git a/scripts/prepare-host-key.sh b/scripts/prepare-host-key.sh index 07910ac..8e4390c 100755 --- a/scripts/prepare-host-key.sh +++ b/scripts/prepare-host-key.sh @@ -62,8 +62,8 @@ Generated: ${keyfile}(.pub) a) Rebuild the installer image with all host-keys/ baked in (see docs/auto-installer.md): NIXOS_HOST_KEYS_DIR="${keydir}" nix build .#iso --impure - (or .#lxc / .#pxe / .#all — --impure is required since host-keys/ - is gitignored and flakes can't see it otherwise) + (or .#pxe — --impure is required since host-keys/ is gitignored and + flakes can't see it otherwise) b) Or, for an image already built without keys, scp it in after boot: scp ${keyfile}{,.pub} root@:/root/host-keys/