mirror of
https://github.com/nix-community/flakelight.git
synced 2025-06-21 10:07:51 +02:00
Export autoloadAttr
This commit is contained in:
parent
867bf2ba6e
commit
bbe8e3a442
16
default.nix
16
default.nix
@ -11,7 +11,7 @@ let
|
|||||||
optionalString parseDrvName pathExists pipe recursiveUpdate removePrefix
|
optionalString parseDrvName pathExists pipe recursiveUpdate removePrefix
|
||||||
removeSuffix zipAttrsWith;
|
removeSuffix zipAttrsWith;
|
||||||
|
|
||||||
exports = { inherit mkFlake loadNixDir systems; };
|
exports = { inherit mkFlake loadNixDir systems autoloadAttr; };
|
||||||
|
|
||||||
baseModule = src: inputs: root: {
|
baseModule = src: inputs: root: {
|
||||||
withOverlays = params: [
|
withOverlays = params: [
|
||||||
@ -47,10 +47,10 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
autoAttrs = src: root:
|
autoloadAttr = src: root: attr:
|
||||||
let
|
let
|
||||||
nixDir = root.nixDir or (src + /nix);
|
nixDir = root.nixDir or (src + /nix);
|
||||||
loadAttr = attr:
|
in
|
||||||
if pathExists (nixDir + "/${attr}.nix")
|
if pathExists (nixDir + "/${attr}.nix")
|
||||||
then import (nixDir + "/${attr}.nix")
|
then import (nixDir + "/${attr}.nix")
|
||||||
else if pathExists (nixDir + "/${attr}/default.nix")
|
else if pathExists (nixDir + "/${attr}/default.nix")
|
||||||
@ -58,7 +58,8 @@ let
|
|||||||
else if pathExists (nixDir + "/${attr}")
|
else if pathExists (nixDir + "/${attr}")
|
||||||
then loadNixDir (nixDir + "/${attr}")
|
then loadNixDir (nixDir + "/${attr}")
|
||||||
else null;
|
else null;
|
||||||
attrs = [
|
|
||||||
|
autoAttrs = [
|
||||||
"withOverlay"
|
"withOverlay"
|
||||||
"withOverlays"
|
"withOverlays"
|
||||||
"package"
|
"package"
|
||||||
@ -79,8 +80,9 @@ let
|
|||||||
"perSystem"
|
"perSystem"
|
||||||
"outputs"
|
"outputs"
|
||||||
];
|
];
|
||||||
in
|
|
||||||
filterAttrs (_: v: v != null) (genAttrs attrs loadAttr);
|
genAutoAttrs = src: root:
|
||||||
|
filterAttrs (_: v: v != null) (genAttrs autoAttrs (autoloadAttr src root));
|
||||||
|
|
||||||
mkFlake = src: inputs: root:
|
mkFlake = src: inputs: root:
|
||||||
let
|
let
|
||||||
@ -143,7 +145,7 @@ let
|
|||||||
|
|
||||||
root' =
|
root' =
|
||||||
let
|
let
|
||||||
rootWithAuto = (autoAttrs src root) // root;
|
rootWithAuto = (genAutoAttrs 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