From c2b5e4eafecdfa3fac66acb9ebbea0b213f24177 Mon Sep 17 00:00:00 2001 From: UGA Innovation Factory Date: Mon, 5 Jan 2026 11:58:08 -0500 Subject: [PATCH 1/4] feat: add zima1 thru zima3 to hosts --- hosts/types/nix-zima.nix | 51 ++++++++++++++++++++++++++++++++++++++++ inventory.nix | 2 ++ 2 files changed, 53 insertions(+) create mode 100644 hosts/types/nix-zima.nix diff --git a/hosts/types/nix-zima.nix b/hosts/types/nix-zima.nix new file mode 100644 index 0000000..d065186 --- /dev/null +++ b/hosts/types/nix-zima.nix @@ -0,0 +1,51 @@ +# ============================================================================ +# Desktop Configuration +# ============================================================================ +# Hardware and boot configuration for standard desktop workstations. +# Includes Intel CPU support and NVMe storage. + +{ inputs, ... }: +{ + config, + lib, + modulesPath, + ... +}: +{ + imports = [ + (import ../common.nix { inherit inputs; }) + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + # ========== Boot Configuration ========== + + boot.initrd.availableKernelModules = [ + "xhci_pci" # USB 3.0 support + "usb_storage" # USB storage devices + "sd_mod" # SD card support + "sdhci_pci" # SD card host controller + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; # Intel virtualization support + boot.extraModulePackages = [ ]; + boot.kernelParams = [ + "quiet" # Minimal boot messages + "splash" # Show Plymouth boot splash + "boot.shell_on_fail" # Emergency shell on boot failure + "udev.log_priority=3" # Reduce udev logging + "rd.systemd.show_status=auto" # Show systemd status during boot + ]; + + # ========== Filesystem Configuration ========== + athenix.host.filesystem.swapSize = lib.mkDefault "0G"; + athenix.host.filesystem.device = lib.mkDefault "/dev/mmcblk0"; + athenix.host.buildMethods = lib.mkDefault [ "installer-iso" ]; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + + # ========== Hardware Configuration ========== + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + # ========== Software Profile ========== + athenix.sw.enable = lib.mkDefault true; + athenix.sw.type = lib.mkDefault "desktop"; +} diff --git a/inventory.nix b/inventory.nix index 0d1ab70..edcbdc8 100644 --- a/inventory.nix +++ b/inventory.nix @@ -139,6 +139,8 @@ }; }; + nix-zima.devices = 3; + # ========== Ephemeral/Netboot System ========== # Creates: nix-ephemeral1 nix-ephemeral.devices = 1; From c6f4a39eeeabfddf0d16fad8697dcf1ca1327b24 Mon Sep 17 00:00:00 2001 From: UGA Innovation Factory Date: Mon, 5 Jan 2026 11:58:38 -0500 Subject: [PATCH 2/4] fix: work on making the installer work offline --- hosts/boot.nix | 7 ++++++- hosts/types/nix-zima.nix | 2 +- installer/auto-install.nix | 17 ++++++++++++++++- inventory.nix | 2 ++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/hosts/boot.nix b/hosts/boot.nix index 73e8f6c..a186612 100644 --- a/hosts/boot.nix +++ b/hosts/boot.nix @@ -34,6 +34,11 @@ type = lib.types.str; description = "The main disk device to use for installation."; }; + useSwap = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Whether to create and use a swap partition."; + }; swapSize = lib.mkOption { type = lib.types.str; description = "The size of the swap partition."; @@ -115,7 +120,7 @@ }; # Swap Partition (size configurable per host) - swap = { + swap = lib.mkIf config.athenix.host.filesystem.useSwap { name = "swap"; label = "swap"; size = config.athenix.host.filesystem.swapSize; diff --git a/hosts/types/nix-zima.nix b/hosts/types/nix-zima.nix index d065186..40a9cec 100644 --- a/hosts/types/nix-zima.nix +++ b/hosts/types/nix-zima.nix @@ -37,7 +37,7 @@ ]; # ========== Filesystem Configuration ========== - athenix.host.filesystem.swapSize = lib.mkDefault "0G"; + athenix.host.filesystem.useSwap = lib.mkDefault false; athenix.host.filesystem.device = lib.mkDefault "/dev/mmcblk0"; athenix.host.buildMethods = lib.mkDefault [ "installer-iso" ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; diff --git a/installer/auto-install.nix b/installer/auto-install.nix index 0bfc6e2..68640cc 100644 --- a/installer/auto-install.nix +++ b/installer/auto-install.nix @@ -13,6 +13,7 @@ ... }: { + # Ensure the entire system closure and all dependencies are included in the ISO environment.systemPackages = [ pkgs.git pkgs.bashInteractive @@ -20,6 +21,14 @@ targetSystem ]; + # Explicitly include the system closure in the ISO image to prevent any need to build or fetch + isoImage.contents = [ + { + source = targetSystem; + target = "/system"; + } + ]; + nixpkgs.hostPlatform = hostPlatform; systemd.services.auto-install = { @@ -45,7 +54,13 @@ ${diskoScript} echo ">>> Running nixos-install..." - nixos-install --no-root-passwd --system ${targetSystem} + # Use only local store - don't fetch from binary cache or build + nixos-install \ + --no-root-passwd \ + --root /mnt \ + --system ${targetSystem} \ + --option substitute false \ + --option build-use-sandbox false echo ">>> Done. Rebooting." systemctl reboot diff --git a/inventory.nix b/inventory.nix index edcbdc8..f292de7 100644 --- a/inventory.nix +++ b/inventory.nix @@ -139,6 +139,8 @@ }; }; + # ========== ZimaBoard Desktops ========== + # Creates: nix-zima1, nix-zima2, nix-zima3 nix-zima.devices = 3; # ========== Ephemeral/Netboot System ========== From 4c218190c317c74fb417bbf293f99fec23d7ed68 Mon Sep 17 00:00:00 2001 From: UGA Innovation Factory Date: Mon, 5 Jan 2026 12:16:51 -0500 Subject: [PATCH 3/4] fix: ensure system closure is installed for derivations needed by the installer --- installer/auto-install.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/installer/auto-install.nix b/installer/auto-install.nix index 68640cc..85c882c 100644 --- a/installer/auto-install.nix +++ b/installer/auto-install.nix @@ -53,14 +53,18 @@ echo ">>> Running disko script..." ${diskoScript} + echo ">>> Copying system closure to target..." + # Copy the entire system closure without substitution + nix-store --store /mnt --load-db < <(nix-store --dump-db) + nix-copy-closure --to /mnt ${targetSystem} 2>/dev/null || true + echo ">>> Running nixos-install..." - # Use only local store - don't fetch from binary cache or build + # Install with pre-built closure already in store nixos-install \ --no-root-passwd \ --root /mnt \ --system ${targetSystem} \ - --option substitute false \ - --option build-use-sandbox false + --option substitute false echo ">>> Done. Rebooting." systemctl reboot From b23525df7840d6e380ccd32d5cebabf2000b5d77 Mon Sep 17 00:00:00 2001 From: UGA Innovation Factory Date: Mon, 5 Jan 2026 12:29:32 -0500 Subject: [PATCH 4/4] fix: build closure in build-step instead of on iso --- installer/artifacts.nix | 7 +++++++ installer/auto-install.nix | 21 +++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/installer/artifacts.nix b/installer/artifacts.nix index 087b1d1..c862a21 100644 --- a/installer/artifacts.nix +++ b/installer/artifacts.nix @@ -20,6 +20,12 @@ let targetConfig = self.nixosConfigurations.${hostName}.config; targetSystem = targetConfig.system.build.toplevel; diskoScript = targetConfig.system.build.diskoScript; + + # Build the closure export at build time (not runtime in ISO) + closureExport = pkgs.runCommand "closure-export-${hostName}" { } '' + mkdir -p $out + ${pkgs.nix}/bin/nix-store --export $(${pkgs.nix}/bin/nix-store -qR ${targetSystem}) > $out/closure.nar + ''; in nixpkgs.lib.nixosSystem { inherit system; @@ -29,6 +35,7 @@ let hostName targetSystem diskoScript + closureExport ; hostPlatform = system; }; diff --git a/installer/auto-install.nix b/installer/auto-install.nix index 85c882c..63d0ef1 100644 --- a/installer/auto-install.nix +++ b/installer/auto-install.nix @@ -1,6 +1,7 @@ # This module defines a systemd service that automatically installs NixOS to the disk. # It is intended to be used in an installation ISO. -# It expects `targetSystem` (the closure to install) and `diskoScript` (the partitioning script) to be passed as arguments. +# It expects `targetSystem` (the closure to install), `diskoScript` (the partitioning script), +# and `closureExport` (the pre-built NAR archive) to be passed as arguments. { config, lib, @@ -10,6 +11,7 @@ hostPlatform, targetSystem, diskoScript, + closureExport, ... }: { @@ -21,8 +23,12 @@ targetSystem ]; - # Explicitly include the system closure in the ISO image to prevent any need to build or fetch + # Explicitly include the pre-built closure export and system in the ISO image isoImage.contents = [ + { + source = closureExport; + target = "/closure-export"; + } { source = targetSystem; target = "/system"; @@ -53,14 +59,13 @@ echo ">>> Running disko script..." ${diskoScript} - echo ">>> Copying system closure to target..." - # Copy the entire system closure without substitution - nix-store --store /mnt --load-db < <(nix-store --dump-db) - nix-copy-closure --to /mnt ${targetSystem} 2>/dev/null || true + echo ">>> Importing pre-built closure into target store..." + # Import the closure that was exported at build time + ${pkgs.nix}/bin/nix-store --store /mnt --import < /closure-export/closure.nar > /dev/null echo ">>> Running nixos-install..." - # Install with pre-built closure already in store - nixos-install \ + # Install with pre-built closure already imported (no evaluation or fetching needed) + ${pkgs.nix}/bin/nixos-install \ --no-root-passwd \ --root /mnt \ --system ${targetSystem} \