Simplify installer into shared common.nix + per-platform targets

Replaces the single monolithic installer.nix (preserved as
installer_old.nix for reference) with a shared common.nix carrying the
install-script/user/SSH baseline, consumed by per-platform targets
(installer.nix for netboot/ISO, new proxmox-lxc.nix for the Proxmox
LXC-based flow). flake.nix drops the nixos-generators input in favor
of building images directly from each nixosConfiguration's
system.build.isoImage/tarball.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
beatzaplentyandClaude Sonnet 5 committed 2026-07-19 13:12:46 +10:00
1 parent 48a879e2a0
commit a90e736743
6 files changed
+464 -254

No files matched your search

+93 -48
View File
@@ -1,68 +1,113 @@
# flake.nix
{
description = "Auto-install NixOS ISO";
inputs = {
# nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
nixos-conf-editor.url = "github:snowfallorg/nixos-conf-editor";
flake-utils.url = "github:numtide/flake-utils";
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
# home-manager.url = "github:nix-community/home-manager";
# home-manager.inputs.nixpkgs.follows = "nixpkgs";
home-manager = {
url = "github:nix-community/home-manager/release-26.05";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, nixos-generators, home-manager, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
iso = nixos-generators.nixosGenerate {
inherit system;
format = "install-iso";
modules = [
./installer.nix
outputs = { self, nixpkgs, flake-utils, home-manager, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
netbootSystem = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./installer.nix
({ modulesPath, ... }: {
imports = [
(modulesPath + "/installer/netboot/netboot-minimal.nix")
];
})
];
};
in
{
#
# Complete NixOS systems
#
# These can be used with:
#
# nixos-rebuild switch --flake .#name
#
nixosConfigurations = {
installer =
nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./installer.nix
];
};
proxmox-lxc =
nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./proxmox-lxc.nix
];
};
};
#
# Buildable artifacts
#
# These are built with:
#
# nix build .#name
#
packages.${system} = {
netboot-ipxe =
netbootSystem.config.system.build.netbootIpxeScript;
netboot-initrd =
netbootSystem.config.system.build.netbootRamdisk;
netboot-kernel =
netbootSystem.config.system.build.kernel;
images =
pkgs.linkFarm "images" [
{
name = "installer-iso";
path = self.nixosConfigurations.installer.config.system.build.isoImage;
}
{
name = "proxmox-lxc";
path = self.nixosConfigurations.proxmox-lxc.config.system.build.tarball;
}
];
};
};
netbootSystem = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./installer.nix
({ modulesPath, ... }: {
imports = [
(modulesPath + "/installer/netboot/netboot-minimal.nix")
];
})
];
};
in {
packages.default = iso;
# packages.netboot = netbootSystem.config.system.build.netboot;
#packages.netboot-debug =
# pkgs.writeText "attrs.json"
# (builtins.toJSON
# (builtins.attrNames netbootSystem.config.system.build));
packages.netboot-ipxe = netbootSystem.config.system.build.netbootIpxeScript;
packages.netboot-initrd = netbootSystem.config.system.build.netbootRamdisk;
packages.netboot-kernel = netbootSystem.config.system.build.kernel;
});
}
};
}