feat(installer): add one-file installer build and custom install ISO
Replace old_installer.py with a curses TUI installer packaged as a one-file PyInstaller binary (python/installer/build.py, wrapped by python/installer/package.nix). The default .#installer is patched to run on foreign Linux live media; the new .#installer-nixos variant keeps its Nix store interpreter so it runs on NixOS. Add systems/iso, a minimal NixOS install CD with kernel 6.18 and ZFS 2.4 matching the deployed systems and the installer on PATH; build it with nix build .#iso. Shared logging and subprocess helpers move out of common.py into python/logging_config.py and python/process.py.
This commit is contained in:
@@ -1 +1,51 @@
|
||||
# dotfiles
|
||||
|
||||
## Installer ISO
|
||||
|
||||
Build a bootable NixOS ISO with the installer preinstalled:
|
||||
|
||||
```sh
|
||||
nix build .#iso
|
||||
```
|
||||
|
||||
Write `result/iso/nixos-zfs-installer.iso` to a USB stick (for example with `dd`) or boot it in a VM. The image is the minimal NixOS installation CD with ZFS enabled and `nixos-installer` on `PATH`, so once booted you can run:
|
||||
|
||||
```sh
|
||||
sudo nixos-installer
|
||||
```
|
||||
|
||||
The ISO bundles the `.#installer-nixos` package, a variant of the binary that keeps its Nix store linkage instead of being patched for foreign distributions.
|
||||
|
||||
## Installer binary
|
||||
|
||||
Build the self-contained installer executable with:
|
||||
|
||||
```sh
|
||||
nix build .#installer
|
||||
```
|
||||
|
||||
The flake package (defined in `python/installer/package.nix`) uses the Python builder in `python/installer/build.py`, which stages only the installer modules before running PyInstaller. You can also call it directly when `pyinstaller` and `patchelf` are on `PATH`:
|
||||
|
||||
```sh
|
||||
python -m python.installer.build --output ./nixos-installer
|
||||
```
|
||||
|
||||
Copy `result/bin/nixos-installer` to the installer USB stick and run it as root from the NixOS live environment:
|
||||
|
||||
```sh
|
||||
sudo ./nixos-installer
|
||||
```
|
||||
|
||||
Validate the live environment first with:
|
||||
|
||||
```sh
|
||||
./nixos-installer --check
|
||||
```
|
||||
|
||||
Set `ENCRYPT_KEY` to enable LUKS during install:
|
||||
|
||||
```sh
|
||||
sudo env ENCRYPT_KEY='change-me' ./nixos-installer
|
||||
```
|
||||
|
||||
The binary bundles the Python runtime and only the installer modules it imports. It still expects the NixOS installer environment to provide system install tools such as `parted`, `zfs`, `zpool`, `cryptsetup`, `nixos-generate-config`, and `nixos-install`.
|
||||
|
||||
Reference in New Issue
Block a user