flake: use listFilesRecursive for normal imports

This commit is contained in:
Donovan Glover 2024-10-09 19:34:03 -04:00
parent bb65333491
commit 723c5c6f0d
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -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
)); ));
} }