Merge branch 'offline-installer'
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 commit is contained in:
2026-01-05 15:43:28 -05:00
5 changed files with 94 additions and 3 deletions

View File

@@ -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;

51
hosts/types/nix-zima.nix Normal file
View File

@@ -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.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";
# ========== 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";
}

View File

@@ -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;
};

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,9 +11,11 @@
hostPlatform,
targetSystem,
diskoScript,
closureExport,
...
}:
{
# Ensure the entire system closure and all dependencies are included in the ISO
environment.systemPackages = [
pkgs.git
pkgs.bashInteractive
@@ -20,6 +23,18 @@
targetSystem
];
# Explicitly include the pre-built closure export and system in the ISO image
isoImage.contents = [
{
source = closureExport;
target = "/closure-export";
}
{
source = targetSystem;
target = "/system";
}
];
nixpkgs.hostPlatform = hostPlatform;
systemd.services.auto-install = {
@@ -44,8 +59,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..."
nixos-install --no-root-passwd --system ${targetSystem}
# 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
echo ">>> Done. Rebooting."
systemctl reboot

View File

@@ -139,6 +139,10 @@
};
};
# ========== ZimaBoard Desktops ==========
# Creates: nix-zima1, nix-zima2, nix-zima3
nix-zima.devices = 3;
# ========== Ephemeral/Netboot System ==========
# Creates: nix-ephemeral1
nix-ephemeral.devices = 1;