fix: work on making the installer work offline

fix: ensure system closure is installed for derivations needed by the installer

fix: build closure in build-step instead of on iso
This commit is contained in:
UGA Innovation Factory
2026-01-05 11:58:38 -05:00
parent c6f4a39eee
commit f68c63590b
2 changed files with 17 additions and 5 deletions

View File

@@ -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,
...
}:
{
@@ -53,14 +55,17 @@
echo ">>> Running disko script..."
${diskoScript}
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..."
# Use only local store - don't fetch from binary cache or build
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} \
--option substitute false \
--option build-use-sandbox false
--option substitute false
echo ">>> Done. Rebooting."
systemctl reboot