Enable filtering
Honor the value of `exclude` in a distro listing. It has already been in use to exclude Debian 12 from building on virtualbox-iso, but now we will actually honor that call. Also, tightens up the code that generates all the scripts so that it is less verbose and more legible Fixes #26
This commit is contained in:
@@ -29,16 +29,12 @@
|
||||
d = flat;
|
||||
provider = providers;
|
||||
};
|
||||
active = builtins.filter (x: (x ? eol) && (!x.eol)) withProviders;
|
||||
active = builtins.filter (
|
||||
x:
|
||||
!(x.eol or false) && ((lib.lists.findFirstIndex (y: y == x.provider) (-1) (x.exclude or [ ])) == -1)
|
||||
) withProviders;
|
||||
name = d: "-${d.distro}-${d.arch}-${d.provider}-${d.version}";
|
||||
distroFile = d: "distros/${d.distro}/${d.version}/${d.arch}.pkrvars.hcl";
|
||||
cmd = d: ''
|
||||
# This is a workaround for a goofy behavior in CI
|
||||
if [ -e "''${PACKER_CONFIG_DIR}" ]; then
|
||||
find "''${PACKER_CONFIG_DIR}" -name '*_linux_amd64' -exec chmod +x '{}' ";"
|
||||
fi
|
||||
packer init sources
|
||||
packer build -only=${d.provider}.${d.arch} -var-file=${distroFile d}'';
|
||||
in
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
flake = {
|
||||
@@ -88,7 +84,10 @@
|
||||
# This is not special, this is just flakes
|
||||
packages =
|
||||
let
|
||||
base = {
|
||||
base =
|
||||
prefix: d: args:
|
||||
pkgs.writeShellApplication {
|
||||
name = "${prefix}${name d}";
|
||||
runtimeInputs = with pkgs; [
|
||||
cdrtools
|
||||
findutils
|
||||
@@ -97,59 +96,24 @@
|
||||
vagrant
|
||||
xorriso
|
||||
];
|
||||
text = ''
|
||||
# This is a workaround for a goofy behavior in CI
|
||||
if [ -e "''${PACKER_CONFIG_DIR}" ]; then
|
||||
find "''${PACKER_CONFIG_DIR}" -name '*_linux_amd64' -exec chmod +x '{}' ";"
|
||||
fi
|
||||
packer init sources
|
||||
packer build -only=${d.provider}.${d.arch} -var-file=${distroFile d} ${args} sources/
|
||||
'';
|
||||
};
|
||||
build =
|
||||
d:
|
||||
let
|
||||
vp =
|
||||
x:
|
||||
if x.provider == "qemu" then
|
||||
"libvirt"
|
||||
else if x.provider == "virtualbox-iso" then
|
||||
"virtualbox"
|
||||
else if x.provider == "hyperv-iso" then
|
||||
"hyperv"
|
||||
else
|
||||
"unknown";
|
||||
in
|
||||
pkgs.writeShellApplication (
|
||||
base
|
||||
// {
|
||||
name = "build${name d}";
|
||||
text = ''
|
||||
set -x
|
||||
${cmd d} -except=upload -var headless=false sources/
|
||||
vagrant box add --provider ${vp d} ./output/${vp d}/${d.distro}-${d.version}.box --name test_box --force
|
||||
'';
|
||||
}
|
||||
);
|
||||
cibuild =
|
||||
d:
|
||||
pkgs.writeShellApplication (
|
||||
base
|
||||
// {
|
||||
name = "ci${name d}";
|
||||
text = ''
|
||||
set -x
|
||||
${cmd d} -except=upload sources/
|
||||
'';
|
||||
}
|
||||
);
|
||||
upload =
|
||||
d:
|
||||
pkgs.writeShellApplication (
|
||||
base
|
||||
// {
|
||||
name = "upload${name d}";
|
||||
text = ''
|
||||
set -x
|
||||
${cmd d} sources/
|
||||
'';
|
||||
}
|
||||
);
|
||||
builds = lib.lists.foldr (d: acc: acc // { "build${name d}" = (build d); }) { } withProviders;
|
||||
uploads = lib.lists.foldr (d: acc: acc // { "upload${name d}" = (upload d); }) { } withProviders;
|
||||
cibuilds = lib.lists.foldr (d: acc: acc // { "ci${name d}" = (cibuild d); }) { } withProviders;
|
||||
builds = lib.lists.foldr (
|
||||
d: acc: acc // { "build${name d}" = (base "build" d "-except=upload -var headless=false"); }
|
||||
) { } withProviders;
|
||||
cibuilds = lib.lists.foldr (
|
||||
d: acc: acc // { "ci${name d}" = (base "ci" d "-except=upload"); }
|
||||
) { } withProviders;
|
||||
uploads = lib.lists.foldr (
|
||||
d: acc: acc // { "upload${name d}" = (base "upload" d ""); }
|
||||
) { } withProviders;
|
||||
qemu_list = builtins.map (d: { buildcmd = (name d); }) (
|
||||
builtins.filter (x: x.provider == "qemu") active
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user