From 2cde01ee4336bc90bac97fd30dcbd3dfc9755a60 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 24 Dec 2022 17:33:43 +0100 Subject: [PATCH] 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 ``. --- lib.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib.nix b/lib.nix index 4a5bf63c..418d6ff8 100644 --- a/lib.nix +++ b/lib.nix @@ -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 ""; + 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