flake.nix: wrap hydraJobs to enable hydra-build-products

makes these files downloadable through the Hydra web interface
This commit is contained in:
Astro 2021-04-12 21:11:16 +02:00
parent 4b8b1a9382
commit bc65da708d
1 changed files with 32 additions and 0 deletions

View File

@ -53,5 +53,37 @@
# For `nix flake check`, and Hydra
checks = self.packages;
hydraJobs =
with self.lib;
let
exportFileWrapper = pkg:
hydraJob (
nixpkgs.legacyPackages.${system}.runCommand "${pkg.name}-exported" {
src = pkg;
} ''
NAME="${pkg.name}"
mkdir -p $out/nix-support
ln -s ${pkg} $out/$NAME
echo file source-dist $out/$NAME >> $out/nix-support/hydra-build-products
''
);
wrappers = {
"all-device-scripts" = pkg:
hydraJob pkg;
"export-config" = exportFileWrapper;
".*-pillar" = exportFileWrapper;
"switch-.*" = exportFileWrapper;
"ap.*" = exportFileWrapper;
};
in
builtins.mapAttrs (name: pkg:
builtins.foldl' (result: wrapperName:
if builtins.match wrapperName name != null
then wrappers.${wrapperName} pkg
else result
) pkg (builtins.attrNames wrappers)
) self.packages.${system};
};
}