feat(flake): perform final fixups to the flake outputs

As flake-parts doesn't really support a concept of limited supported system (e.g. system for which
we don't have CI), we need to fix up the final outputs to move the unsupported checks to another place
where CI won't run them.
This commit is contained in:
Raito Bezarius 2023-11-10 15:15:48 +01:00
parent bc0fd4e1d9
commit b7f3d60708
1 changed files with 20 additions and 2 deletions

View File

@ -36,7 +36,25 @@
}; };
outputs = inputs@{ self, nixpkgs, crane, rust-overlay, flake-parts, ... }: outputs = inputs@{ self, nixpkgs, crane, rust-overlay, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } ({ moduleWithSystem, ... }: { let
# Systems supported in CI
supportedSystems = [ "x86_64-linux" ];
fixupFlakes = outputs: nixpkgs.lib.updateManyAttrsByPath [
# Apply post-flakeparts massaging for limited supported systems, e.g. systems for which
# we don't have KVM support and cannot test in CI, but we still can meaningfully
# build packages.
{
path = [ "legacyPackages" "unsupportedChecks" ];
update = checks: checks // (nixpkgs.lib.filterAttrs (name: _: !builtins.elem name supportedSystems) outputs.checks);
}
{
path = [ "checks" ];
update = nixpkgs.lib.filterAttrs (name: _: builtins.elem name supportedSystems);
}
]
outputs;
in
fixupFlakes (flake-parts.lib.mkFlake { inherit inputs; } ({ moduleWithSystem, ... }: {
imports = [ imports = [
# Derive the output overlay automatically from all packages that we define. # Derive the output overlay automatically from all packages that we define.
inputs.flake-parts.flakeModules.easyOverlay inputs.flake-parts.flakeModules.easyOverlay
@ -255,5 +273,5 @@
TEST_SYSTEMD = pkgs.systemd; TEST_SYSTEMD = pkgs.systemd;
}; };
}; };
}); }));
} }