Skip to content

Commit

Permalink
feat: base custom loader on applyModuleArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
korrat committed Aug 21, 2024
1 parent 84c2ee4 commit 6a13282
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,7 @@
cr = cell.__cr ++ [(baseNameOf src)];
file = "${self.outPath}#${lib.concatStringsSep "/" cr}";

defaultWith = let
inherit
(lib)
functionArgs
pipe
toFunction
;
in (importer: inputs: path: let
f = toFunction (importer path);
in
pipe f [
functionArgs
(let
context = name: ''while evaluating the argument `${name}' in "${file}":'';
in
builtins.mapAttrs (
name: _:
builtins.addErrorContext (context name)
(inputs.${name} or config._module.args.${name})
))
f
]);
defaultWith = importer: inputs: path: lib.modules.applyModuleArgsIfFunction file (importer path) inputs;
loader = inputs: defaultWith (scopedImport inputs) inputs;
i = args // {inherit cell inputs;};
in
Expand Down

0 comments on commit 6a13282

Please sign in to comment.