Skip to content

Commit

Permalink
mkFlake: Set default module location
Browse files Browse the repository at this point in the history
`outPath + "/flake.nix"` is technically an unfounded assumption,
except almost all calls will be made from flake.nix.
It surely is a lot better than `<unknown location>`.
  • Loading branch information
roberth committed Dec 24, 2022
1 parent b7405da commit 2cde01e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,15 @@ let
);

mkFlake = args: module:
(flake-parts-lib.evalFlakeModule args module).config.flake;
let
loc =
if args?inputs.self.outPath
then args.inputs.self.outPath + "/flake.nix"
else "<mkFlake argument>";
mod = lib.setDefaultModuleLocation loc module;
eval = flake-parts-lib.evalFlakeModule args mod;
in
eval.config.flake;

# For extending options in an already declared submodule.
# Workaround for https://github.com/NixOS/nixpkgs/issues/146882
Expand Down

0 comments on commit 2cde01e

Please sign in to comment.