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

mkFlake: Set default module location

`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>`.
This commit is contained in:
Robert Hensing 2022-12-24 17:33:43 +01:00
parent b7405dad3f
commit 2cde01ee43

10
lib.nix
View file

@ -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