From 2f2a305df4502200bc658e0ec07243797c394b0d Mon Sep 17 00:00:00 2001 From: UGA Innovation Factory Date: Mon, 5 Jan 2026 15:56:27 -0500 Subject: [PATCH] Revert "fix: build closure in build-step instead of on iso" This reverts commit b23525df7840d6e380ccd32d5cebabf2000b5d77. --- installer/artifacts.nix | 7 ------- installer/auto-install.nix | 25 +++++++++++++++++-------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/installer/artifacts.nix b/installer/artifacts.nix index 31752cf..3e835b6 100644 --- a/installer/artifacts.nix +++ b/installer/artifacts.nix @@ -20,12 +20,6 @@ let targetConfig = self.nixosConfigurations.${hostName}.config; targetSystemBuild = targetConfig.system.build; 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; @@ -35,7 +29,6 @@ let hostName targetSystemBuild diskoScript - closureExport ; hostPlatform = system; }; diff --git a/installer/auto-install.nix b/installer/auto-install.nix index 67a8ef2..1c2274d 100644 --- a/installer/auto-install.nix +++ b/installer/auto-install.nix @@ -1,7 +1,6 @@ # 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), `diskoScript` (the partitioning script), -# and `closureExport` (the pre-built NAR archive) to be passed as arguments. +# It expects `targetSystem` (the closure to install) and `diskoScript` (the partitioning script) to be passed as arguments. { config, lib, @@ -11,7 +10,6 @@ hostPlatform, targetSystemBuild, diskoScript, - closureExport, ... }: { @@ -23,12 +21,8 @@ targetSystemBuild.toplevel ]; - # Explicitly include the pre-built closure export and system in the ISO image + # Explicitly include the system closure in the ISO image to prevent any need to build or fetch isoImage.contents = [ - { - source = closureExport; - target = "/closure-export"; - } { source = targetSystem; target = "/system"; @@ -65,12 +59,27 @@ echo ">>> Running disko script..." ${diskoScript} +<<<<<<< HEAD echo ">>> Setting up NixOS..." nixos-install \ --system ${targetSystemBuild.toplevel} \ --no-root-passwd \ --no-channel-copy \ --substituters "" +======= + 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..." + # Install with pre-built closure already in store + nixos-install \ + --no-root-passwd \ + --root /mnt \ + --system ${targetSystem} \ + --option substitute false +>>>>>>> parent of b23525d (fix: build closure in build-step instead of on iso) echo ">>> Done. Rebooting." systemctl reboot