mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-11-24 17:23:09 +01:00
flake: remove attribute name map
Reduces complexity a bit now that we're using listFilesRecursive.
This commit is contained in:
parent
723c5c6f0d
commit
de8791ea22
50
flake.nix
50
flake.nix
@ -39,18 +39,6 @@
|
||||
inherit (nixpkgs.legacyPackages) x86_64-linux aarch64-linux;
|
||||
inherit (builtins) listToAttrs map replaceStrings;
|
||||
|
||||
flakeOutputs = [
|
||||
"overlays"
|
||||
"nixosModules"
|
||||
"homeModules"
|
||||
];
|
||||
|
||||
flakeDirectories = [
|
||||
"overlays"
|
||||
"modules"
|
||||
"home"
|
||||
];
|
||||
|
||||
forAllSystems = function:
|
||||
nixpkgs.lib.genAttrs [
|
||||
"x86_64-linux"
|
||||
@ -63,6 +51,27 @@
|
||||
directory = ./packages;
|
||||
});
|
||||
|
||||
nixosModules = listToAttrs (
|
||||
map (file: {
|
||||
name = replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString file));
|
||||
value = import file;
|
||||
}) (listFilesRecursive ./modules)
|
||||
);
|
||||
|
||||
homeModules = listToAttrs (
|
||||
map (file: {
|
||||
name = replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString file));
|
||||
value = import file;
|
||||
}) (listFilesRecursive ./home)
|
||||
);
|
||||
|
||||
overlays = listToAttrs (
|
||||
map (file: {
|
||||
name = replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString file));
|
||||
value = import file;
|
||||
}) (listFilesRecursive ./overlays)
|
||||
);
|
||||
|
||||
checks.x86_64-linux = listToAttrs (map (file: {
|
||||
name = replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString file));
|
||||
|
||||
@ -129,20 +138,5 @@
|
||||
x86_64-linux = x86_64-linux.nixfmt-rfc-style;
|
||||
aarch64-linux = aarch64-linux.nixfmt-rfc-style;
|
||||
};
|
||||
}
|
||||
// (listToAttrs (
|
||||
map (attributeName: {
|
||||
name = attributeName;
|
||||
value =
|
||||
let
|
||||
directory = replaceStrings flakeOutputs flakeDirectories attributeName;
|
||||
in
|
||||
listToAttrs (
|
||||
map (file: {
|
||||
name = replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString file));
|
||||
value = import file;
|
||||
}) (listFilesRecursive ./${directory})
|
||||
);
|
||||
}) flakeOutputs
|
||||
));
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user