1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2024-12-14 11:47:31 +00:00

easyOverlay: Remove performance warning which is not relevant

This commit is contained in:
Robert Hensing 2023-01-05 01:07:58 +01:00
parent c089237966
commit 9ca2803752
2 changed files with 8 additions and 2 deletions

View file

@ -1,4 +1,4 @@
toplevel@{ config, lib, flake-parts-lib, getSystem, ... }:
toplevel@{ config, lib, flake-parts-lib, getSystemIgnoreWarning, ... }:
let
inherit (flake-parts-lib)
mkPerSystemOption;
@ -50,7 +50,7 @@ in
throw "Could not determine the `hostPlatform` of Nixpkgs. Was this overlay loaded as a Nixpkgs overlay, or was it loaded into something else?"
)
);
perSys = (getSystem system).extendModules {
perSys = (getSystemIgnoreWarning system).extendModules {
modules = [
{
_file = "flake-parts#flakeModules.easyOverlay/overlay-overrides";

View file

@ -110,6 +110,12 @@ in
allSystems = genAttrs config.systems config.perSystem;
# TODO: Sub-optimal error message. Get Nix to support a memoization primop, or get Nix Flakes to support systems properly or get Nix Flakes to add a name to flakes.
_module.args.getSystem = system: config.allSystems.${system} or (builtins.trace "using non-memoized system ${system}" config.perSystem system);
# The warning is there for a reason. Only use this in situations where the
# performance cost has already been incurred, such as in `flakeModules.easyOverlay`,
# where we run in the context of an overlay, and the performance cost of the
# extra `pkgs` makes the cost of running `perSystem` probably negligible.
_module.args.getSystemIgnoreWarning = system: config.allSystems.${system} or config.perSystem system;
};
}