mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-14 11:47:31 +00:00
Add moduleLocation to mkFlake argument
tmp
This commit is contained in:
parent
006c75898c
commit
1e8a89e5f8
3 changed files with 12 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
|||
{ config, self, lib, flake-parts-lib, ... }:
|
||||
{ config, self, lib, flake-parts-lib, moduleLocation, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
filterAttrs
|
||||
|
@ -15,8 +15,8 @@ let
|
|||
type = types.lazyAttrsOf types.deferredModule;
|
||||
default = { };
|
||||
apply = mapAttrs (k: v: {
|
||||
_file = "${toString self.outPath}/flake.nix#flakeModules.${k}";
|
||||
key = "${toString self.outPath}/flake.nix#flakeModules.${k}";
|
||||
_file = "${toString moduleLocation}#flakeModules.${k}";
|
||||
key = "${toString moduleLocation}#flakeModules.${k}";
|
||||
imports = [ v ];
|
||||
});
|
||||
description = ''
|
||||
|
|
7
lib.nix
7
lib.nix
|
@ -98,6 +98,7 @@ let
|
|||
|
||||
${errorExample}
|
||||
'')
|
||||
, moduleLocation ? "${self.outPath}/flake.nix"
|
||||
}:
|
||||
throwIf
|
||||
(!args?self && !args?inputs) ''
|
||||
|
@ -117,7 +118,7 @@ let
|
|||
(module:
|
||||
lib.evalModules {
|
||||
specialArgs = {
|
||||
inherit self flake-parts-lib;
|
||||
inherit self flake-parts-lib moduleLocation;
|
||||
inputs = args.inputs or /* legacy, warned above */ self.inputs;
|
||||
} // specialArgs;
|
||||
modules = [ ./all-modules.nix module ];
|
||||
|
@ -138,9 +139,11 @@ let
|
|||
mkFlake = args: module:
|
||||
let
|
||||
loc =
|
||||
args.moduleLocation or (
|
||||
if args?inputs.self.outPath
|
||||
then args.inputs.self.outPath + "/flake.nix"
|
||||
else "<mkFlake argument>";
|
||||
else "<mkFlake argument>"
|
||||
);
|
||||
mod = lib.setDefaultModuleLocation loc module;
|
||||
eval = flake-parts-lib.evalFlakeModule args mod;
|
||||
in
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, self, lib, flake-parts-lib, ... }:
|
||||
{ config, self, lib, flake-parts-lib, moduleLocation, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
filterAttrs
|
||||
|
@ -17,7 +17,7 @@ in
|
|||
nixosModules = mkOption {
|
||||
type = types.lazyAttrsOf types.unspecified;
|
||||
default = { };
|
||||
apply = mapAttrs (k: v: { _file = "${toString self.outPath}/flake.nix#nixosModules.${k}"; imports = [ v ]; });
|
||||
apply = mapAttrs (k: v: { _file = "${toString moduleLocation}#nixosModules.${k}"; imports = [ v ]; });
|
||||
description = ''
|
||||
NixOS modules.
|
||||
|
||||
|
|
Loading…
Reference in a new issue