Skip to content

Commit

Permalink
prepare for garnix
Browse files Browse the repository at this point in the history
Garnix does not build the `hydraJobs` output
so move them all into the `checks` output,
adhering to the flake output schema
because garnix does not build nested attrsets.
  • Loading branch information
dermetfan committed Jan 14, 2025
1 parent 7683b73 commit d0234bf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
26 changes: 25 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
}
);
in
lib.recursiveUpdate flake rec {
lib.recursiveUpdate (removeAttrs flake ["checks"]) rec {
project = cabalProject;
# add a required job, that's basically all hydraJobs.
hydraJobs =
Expand All @@ -203,6 +203,28 @@
revision = nixpkgs.writeText "revision" (inputs.self.rev or "dirty");
};
};

checks = let
# https://github.com/numtide/flake-utils/issues/121#issuecomment-2589899217
recurseIntoDeepAttrs = attrs:
lib.recurseIntoAttrs (
lib.mapAttrs
(
_: v:
if builtins.typeOf v == "set" && !lib.isDerivation v
then recurseIntoDeepAttrs v
else v
)
attrs
);
in
inputs.flake-utils.lib.flattenTree (recurseIntoDeepAttrs (
flake.hydraJobs
// {inherit (legacyPackages) doc specs;}
# contains only the `required` and `nonrequired` jobs
// hydraJobs
));

legacyPackages = rec {
inherit cabalProject nixpkgs;
# also provide hydraJobs through legacyPackages to allow building without system prefix:
Expand Down Expand Up @@ -277,9 +299,11 @@
nixConfig = {
extra-substituters = [
"https://cache.iog.io"
"https://cache.garnix.io"
];
extra-trusted-public-keys = [
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
];
allow-import-from-derivation = true;
};
Expand Down
3 changes: 3 additions & 0 deletions garnix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
builds:
include:
- 'checks.*.*'

0 comments on commit d0234bf

Please sign in to comment.