feat: Add support for ipxe boot ephemeral systems
This commit is contained in:
committed by
Hunter Halloran
parent
1412529b0f
commit
8a4e574b90
@@ -2,6 +2,7 @@
|
||||
let
|
||||
nixpkgs = inputs.nixpkgs;
|
||||
lib = nixpkgs.lib;
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
nixos-generators = inputs.nixos-generators;
|
||||
|
||||
mkInstaller = hostName:
|
||||
@@ -36,16 +37,56 @@ let
|
||||
inherit format;
|
||||
};
|
||||
|
||||
mkNetboot = hostName:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = hosts.modules.${hostName} ++ [
|
||||
"${nixpkgs}/nixos/modules/installer/netboot/netboot.nix"
|
||||
{
|
||||
disko.enableConfig = lib.mkForce false;
|
||||
services.upower.enable = lib.mkForce false;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
hostNames = builtins.attrNames hosts.nixosConfigurations;
|
||||
|
||||
installerPackages = lib.listToAttrs (lib.concatMap (name:
|
||||
let cfg = hosts.nixosConfigurations.${name}; in
|
||||
if lib.elem "iso" cfg.config.host.buildMethods then [{
|
||||
if lib.elem "installer-iso" cfg.config.host.buildMethods then [{
|
||||
name = "installer-iso-${name}";
|
||||
value = (mkInstaller name).config.system.build.isoImage;
|
||||
}] else []
|
||||
) hostNames);
|
||||
|
||||
isoPackages = lib.listToAttrs (lib.concatMap (name:
|
||||
let cfg = hosts.nixosConfigurations.${name}; in
|
||||
if lib.elem "iso" cfg.config.host.buildMethods then [{
|
||||
name = "iso-${name}";
|
||||
value = mkGenerator name "iso";
|
||||
}] else []
|
||||
) hostNames);
|
||||
|
||||
ipxePackages = lib.listToAttrs (lib.concatMap (name:
|
||||
let cfg = hosts.nixosConfigurations.${name}; in
|
||||
if lib.elem "ipxe" cfg.config.host.buildMethods then [{
|
||||
name = "ipxe-${name}";
|
||||
value =
|
||||
let
|
||||
build = (mkNetboot name).config.system.build;
|
||||
in
|
||||
pkgs.symlinkJoin {
|
||||
name = "netboot-artifacts-${name}";
|
||||
paths = [
|
||||
build.netbootRamdisk
|
||||
build.kernel
|
||||
build.netbootIpxeScript
|
||||
];
|
||||
};
|
||||
}] else []
|
||||
) hostNames);
|
||||
|
||||
lxcPackages = lib.listToAttrs (lib.concatMap (name:
|
||||
let cfg = hosts.nixosConfigurations.${name}; in
|
||||
if lib.elem "lxc" cfg.config.host.buildMethods then [{
|
||||
@@ -70,4 +111,4 @@ let
|
||||
}] else []
|
||||
) hostNames);
|
||||
in
|
||||
installerPackages // lxcPackages // proxmoxPackages
|
||||
installerPackages // isoPackages // ipxePackages // lxcPackages // proxmoxPackages
|
||||
|
||||
Reference in New Issue
Block a user