kexec-installer: build variants

This commit is contained in:
Jörg Thalheim 2023-05-07 21:06:12 +02:00
parent 51155d8415
commit 470d1918ab
3 changed files with 120 additions and 97 deletions

View file

@ -22,7 +22,7 @@ build_netboot_image() {
build_kexec_installer() {
declare -r tag=$1 arch=$2 tmp=$3 variant=$4
out=$(nix build --print-out-paths --option accept-flake-config true -L ".#packages.${arch}.kexec-installer-${tag//.}${variant}")
echo "$out/nixos-kexec-installer-$arch.tar.gz"
echo "$out/nixos-kexec-installer${variant}-$arch.tar.gz"
}
main() {

View file

@ -24,11 +24,23 @@
kexec-installer-nixos-unstable = kexec-installer nixos-unstable [];
kexec-installer-nixos-2211 = kexec-installer nixos-2211 [];
kexec-installer-nixos-unstable-noninteractive = kexec-installer nixos-unstable [ self.nixosModules.noninteractive ];
kexec-installer-nixos-2211-noninteractive = kexec-installer nixos-2211 [ self.nixosModules.noninteractive ];
kexec-installer-nixos-unstable-noninteractive = kexec-installer nixos-unstable [
{ system.kexec-installer.name = "kexec-installer-noninteractive"; }
self.nixosModules.noninteractive
];
kexec-installer-nixos-2211-noninteractive = kexec-installer nixos-2211 [
{ system.kexec-installer.name = "kexec-installer-noninteractive"; }
self.nixosModules.noninteractive
];
kexec-installer-nixos-unstable-virtual-noninteractive = kexec-installer nixos-unstable [ self.nixosModules.noninteractive self.nixosModules.virtual ];
kexec-installer-nixos-2211-virtual-noninteractive = kexec-installer nixos-2211 [ self.nixosModules.noninteractive self.nixosModules.virtual ];
kexec-installer-nixos-unstable-virtual-noninteractive = kexec-installer nixos-unstable [
{ system.kexec-installer.name = "kexec-installer-virtual-noninteractive"; }
self.nixosModules.noninteractive self.nixosModules.virtual
];
kexec-installer-nixos-2211-virtual-noninteractive = kexec-installer nixos-2211 [
{ system.kexec-installer.name = "kexec-installer-virtual-noninteractive"; }
self.nixosModules.noninteractive self.nixosModules.virtual
];
});
nixosModules = {
kexec-installer = ./nix/kexec-installer/module.nix;

View file

@ -10,7 +10,17 @@ in {
imports = [
(modulesPath + "/installer/netboot/netboot-minimal.nix")
];
options = {
system.kexec-installer.name = lib.mkOption {
type = lib.types.str;
default = "nixos-kexec-installer";
description = ''
The variant of the kexec installer to use.
'';
};
};
config = {
# We are stateless, so just default to latest.
system.stateVersion = config.system.nixos.version;
@ -34,7 +44,7 @@ in {
cp "${config.system.build.kexecRun}" kexec/run
cp "${pkgs.pkgsStatic.kexec-tools}/bin/kexec" kexec/kexec
cp "${iprouteStatic}/bin/ip" kexec/ip
tar -czvf $out/nixos-kexec-installer-${pkgs.stdenv.hostPlatform.system}.tar.gz kexec
tar -czvf $out/${config.system.kexec-installer.name}-${pkgs.stdenv.hostPlatform.system}.tar.gz kexec
'';
# IPMI SOL console redirection stuff
@ -110,4 +120,5 @@ in {
install -m 400 ssh/ssh_host_* /mnt-root/etc/ssh
cp *.json /mnt-root/root/network/
'';
};
}