mirror of
https://github.com/nix-community/flakelight.git
synced 2025-06-21 01:57:57 +02:00
Only autoload from ./nix or dir specified by nixDir
This commit is contained in:
parent
58503515fb
commit
867bf2ba6e
23
default.nix
23
default.nix
@ -47,21 +47,16 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
autoAttrs = src:
|
autoAttrs = src: root:
|
||||||
let
|
let
|
||||||
|
nixDir = root.nixDir or (src + /nix);
|
||||||
loadAttr = attr:
|
loadAttr = attr:
|
||||||
if pathExists (src + "/nix/${attr}.nix")
|
if pathExists (nixDir + "/${attr}.nix")
|
||||||
then import (src + "/nix/${attr}.nix")
|
then import (nixDir + "/${attr}.nix")
|
||||||
else if pathExists (src + "/nix/${attr}/default.nix")
|
else if pathExists (nixDir + "/${attr}/default.nix")
|
||||||
then import (src + "/nix/${attr}")
|
then import (nixDir + "/${attr}")
|
||||||
else if pathExists (src + "/nix/${attr}")
|
else if pathExists (nixDir + "/${attr}")
|
||||||
then loadNixDir (src + "/nix/${attr}")
|
then loadNixDir (nixDir + "/${attr}")
|
||||||
else if pathExists (src + "/${attr}.nix")
|
|
||||||
then import (src + "/${attr}.nix")
|
|
||||||
else if pathExists (src + "/${attr}/default.nix")
|
|
||||||
then import (src + "/${attr}")
|
|
||||||
else if pathExists (src + "/${attr}")
|
|
||||||
then loadNixDir (src + "/${attr}")
|
|
||||||
else null;
|
else null;
|
||||||
attrs = [
|
attrs = [
|
||||||
"withOverlay"
|
"withOverlay"
|
||||||
@ -148,7 +143,7 @@ let
|
|||||||
|
|
||||||
root' =
|
root' =
|
||||||
let
|
let
|
||||||
rootWithAuto = (autoAttrs src) // root;
|
rootWithAuto = (autoAttrs src root) // root;
|
||||||
in
|
in
|
||||||
normalizeModule rootWithAuto // {
|
normalizeModule rootWithAuto // {
|
||||||
systems = applyParams rootWithAuto.systems or systems.linuxDefault;
|
systems = applyParams rootWithAuto.systems or systems.linuxDefault;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user