Revert "fix: build closure in build-step instead of on iso"
Some checks failed
CI / Flake Check (push) Has been cancelled
CI / Evaluate Key Configurations (nix-builder) (push) Has been cancelled
CI / Evaluate Key Configurations (nix-desktop1) (push) Has been cancelled
CI / Evaluate Key Configurations (nix-laptop1) (push) Has been cancelled
CI / Evaluate Artifacts (installer-iso-nix-laptop1) (push) Has been cancelled
CI / Evaluate Artifacts (lxc-nix-builder) (push) Has been cancelled
CI / Format Check (push) Has been cancelled

This reverts commit b23525df78.
This commit is contained in:
UGA Innovation Factory
2026-01-05 15:56:27 -05:00
parent 30c2146687
commit 2f2a305df4
2 changed files with 17 additions and 15 deletions

View File

@@ -20,12 +20,6 @@ let
targetConfig = self.nixosConfigurations.${hostName}.config; targetConfig = self.nixosConfigurations.${hostName}.config;
targetSystemBuild = targetConfig.system.build; targetSystemBuild = targetConfig.system.build;
diskoScript = targetConfig.system.build.diskoScript; 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 in
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
inherit system; inherit system;
@@ -35,7 +29,6 @@ let
hostName hostName
targetSystemBuild targetSystemBuild
diskoScript diskoScript
closureExport
; ;
hostPlatform = system; hostPlatform = system;
}; };

View File

@@ -1,7 +1,6 @@
# This module defines a systemd service that automatically installs NixOS to the disk. # This module defines a systemd service that automatically installs NixOS to the disk.
# It is intended to be used in an installation ISO. # It is intended to be used in an installation ISO.
# It expects `targetSystem` (the closure to install), `diskoScript` (the partitioning script), # It expects `targetSystem` (the closure to install) and `diskoScript` (the partitioning script) to be passed as arguments.
# and `closureExport` (the pre-built NAR archive) to be passed as arguments.
{ {
config, config,
lib, lib,
@@ -11,7 +10,6 @@
hostPlatform, hostPlatform,
targetSystemBuild, targetSystemBuild,
diskoScript, diskoScript,
closureExport,
... ...
}: }:
{ {
@@ -23,12 +21,8 @@
targetSystemBuild.toplevel 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 = [ isoImage.contents = [
{
source = closureExport;
target = "/closure-export";
}
{ {
source = targetSystem; source = targetSystem;
target = "/system"; target = "/system";
@@ -65,12 +59,27 @@
echo ">>> Running disko script..." echo ">>> Running disko script..."
${diskoScript} ${diskoScript}
<<<<<<< HEAD
echo ">>> Setting up NixOS..." echo ">>> Setting up NixOS..."
nixos-install \ nixos-install \
--system ${targetSystemBuild.toplevel} \ --system ${targetSystemBuild.toplevel} \
--no-root-passwd \ --no-root-passwd \
--no-channel-copy \ --no-channel-copy \
--substituters "" --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." echo ">>> Done. Rebooting."
systemctl reboot systemctl reboot