2025-07-11 21:04:42 +08:00
|
|
|
final: _prev: {
|
|
|
|
|
youthlic = {
|
2025-07-13 06:04:55 +08:00
|
|
|
loadImports' =
|
|
|
|
|
dir: f:
|
2025-07-12 03:53:16 +08:00
|
|
|
final.pipe dir [
|
|
|
|
|
final.youthlic.loadImports
|
|
|
|
|
f
|
|
|
|
|
];
|
2025-07-13 06:04:55 +08:00
|
|
|
loadImports =
|
|
|
|
|
dir:
|
2025-07-12 03:53:16 +08:00
|
|
|
with final;
|
2025-07-13 06:04:55 +08:00
|
|
|
if !(pathExists dir && builtins.readFileType dir == "directory") then
|
|
|
|
|
[ ]
|
|
|
|
|
else
|
|
|
|
|
let
|
|
|
|
|
items = pipe dir [
|
|
|
|
|
builtins.readDir
|
|
|
|
|
attrNames
|
2025-07-12 03:53:16 +08:00
|
|
|
];
|
2025-07-13 06:04:55 +08:00
|
|
|
in
|
|
|
|
|
pipe items [
|
|
|
|
|
(concatMap (
|
|
|
|
|
name:
|
|
|
|
|
let
|
|
|
|
|
path = dir + "/${name}";
|
|
|
|
|
type = builtins.readFileType path;
|
|
|
|
|
in
|
|
|
|
|
if type == "directory" then
|
|
|
|
|
if pathExists (path + "/default.nix") then [ path ] else youthlic.loadImports path
|
|
|
|
|
else if type == "regular" then
|
|
|
|
|
if hasSuffix ".nix" name then [ path ] else [ ]
|
|
|
|
|
else
|
|
|
|
|
[ ]
|
|
|
|
|
))
|
|
|
|
|
(filter (name: !hasSuffix "/default.nix" (toString name)))
|
|
|
|
|
];
|
2025-07-11 21:04:42 +08:00
|
|
|
};
|
|
|
|
|
}
|