mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-11-25 09:43:11 +01:00
flake: use listFilesRecursive for normal imports
This commit is contained in:
parent
bb65333491
commit
723c5c6f0d
25
flake.nix
25
flake.nix
@ -37,14 +37,7 @@
|
|||||||
inherit (nixpkgs.lib) nixosSystem;
|
inherit (nixpkgs.lib) nixosSystem;
|
||||||
inherit (nixpkgs.lib.filesystem) packagesFromDirectoryRecursive listFilesRecursive;
|
inherit (nixpkgs.lib.filesystem) packagesFromDirectoryRecursive listFilesRecursive;
|
||||||
inherit (nixpkgs.legacyPackages) x86_64-linux aarch64-linux;
|
inherit (nixpkgs.legacyPackages) x86_64-linux aarch64-linux;
|
||||||
|
inherit (builtins) listToAttrs map replaceStrings;
|
||||||
inherit (builtins)
|
|
||||||
attrNames
|
|
||||||
listToAttrs
|
|
||||||
map
|
|
||||||
replaceStrings
|
|
||||||
readDir
|
|
||||||
;
|
|
||||||
|
|
||||||
flakeOutputs = [
|
flakeOutputs = [
|
||||||
"overlays"
|
"overlays"
|
||||||
@ -143,17 +136,13 @@
|
|||||||
value =
|
value =
|
||||||
let
|
let
|
||||||
directory = replaceStrings flakeOutputs flakeDirectories attributeName;
|
directory = replaceStrings flakeOutputs flakeDirectories attributeName;
|
||||||
|
|
||||||
attributeValue = listToAttrs (
|
|
||||||
map (file: {
|
|
||||||
name = replaceStrings [ ".nix" ] [ "" ] file;
|
|
||||||
value = import ./${directory}/${file};
|
|
||||||
}) (attrNames (readDir ./${directory}))
|
|
||||||
);
|
|
||||||
|
|
||||||
attributeSet = attributeValue;
|
|
||||||
in
|
in
|
||||||
attributeSet;
|
listToAttrs (
|
||||||
|
map (file: {
|
||||||
|
name = replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString file));
|
||||||
|
value = import file;
|
||||||
|
}) (listFilesRecursive ./${directory})
|
||||||
|
);
|
||||||
}) flakeOutputs
|
}) flakeOutputs
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user