build netboot files from hydra

This commit is contained in:
Yureka 2024-08-01 22:47:25 +02:00
parent 6dc424dd43
commit 1cbf286f18
2 changed files with 35 additions and 2 deletions

View file

@ -114,7 +114,7 @@
public01.imports = commonModules ++ [ ./hosts/public01 ];
} // builders;
hydraJobs = builtins.mapAttrs (n: v: v.config.system.build.toplevel) self.nixosConfigurations;
hydraJobs = builtins.mapAttrs (n: v: v.config.system.build.netbootDir or v.config.system.build.toplevel) self.nixosConfigurations;
buildbotJobs = builtins.mapAttrs (_: v: v.config.system.build.toplevel) self.nixosConfigurations;
};
}

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }:
{ pkgs, lib, config, extendModules, ... }:
let
cfg = config.bagel.baremetal.builders;
in
@ -177,6 +177,39 @@ in
environment.systemPackages = [ pkgs.ipmitool ];
system.build = lib.mkIf cfg.netboot {
netbootVariant = extendModules {
modules = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/netboot/netboot.nix") ];
}
)
];
};
netbootDir = let
kernelTarget = pkgs.stdenv.hostPlatform.linux-kernel.target;
build = config.system.build.netbootVariant.config.system.build;
in
pkgs.symlinkJoin {
name = "netboot";
paths = [
build.netbootRamdisk
build.kernel
build.netbootIpxeScript
];
postBuild = ''
mkdir -p $out/nix-support
echo "file ${kernelTarget} ${build.kernel}/${kernelTarget}" >> $out/nix-support/hydra-build-products
echo "file initrd ${build.netbootRamdisk}/initrd" >> $out/nix-support/hydra-build-products
echo "file ipxe ${build.netbootIpxeScript}/netboot.ipxe" >> $out/nix-support/hydra-build-products
'';
preferLocalBuild = true;
};
};
system.stateVersion = "24.05";
};
}