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

moduleWithSystem: Clarify local variable names

(cherry picked from commit e0baa4cdba)
This commit is contained in:
Dusk Banks 2023-04-19 01:32:18 +00:00 committed by Robert Hensing
parent c3290e4a60
commit df9f1a1bd0

View file

@ -13,19 +13,19 @@
"moduleWithSystem: Could not determine the `system` parameter for this module set evaluation."
);
allArgs = withSystem system (args: args);
allPerSystemArgs = withSystem system (args: args);
lazyArgsPerParameter = f: builtins.mapAttrs
(k: v: allArgs.${k} or (throw "moduleWithSystem: per-system argument `${k}` does not exist."))
lazyPerSystemArgsPerParameter = f: builtins.mapAttrs
(k: v: allPerSystemArgs.${k} or (throw "moduleWithSystem: per-system argument `${k}` does not exist."))
(builtins.functionArgs f);
# Use reflection to make the call lazy in the argument.
# Restricts args to the ones declared.
callLazily = f: a: f (lazyArgsPerParameter f);
callLazily = f: a: f (lazyPerSystemArgsPerParameter f);
in
{
imports = [
(callLazily module allArgs)
(callLazily module allPerSystemArgs)
];
};
};