mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-11-25 01:33:17 +01:00
flake: abstract nameOf for path to name conversion
This commit is contained in:
parent
de8791ea22
commit
786bbcf03a
@ -39,6 +39,7 @@
|
|||||||
inherit (nixpkgs.legacyPackages) x86_64-linux aarch64-linux;
|
inherit (nixpkgs.legacyPackages) x86_64-linux aarch64-linux;
|
||||||
inherit (builtins) listToAttrs map replaceStrings;
|
inherit (builtins) listToAttrs map replaceStrings;
|
||||||
|
|
||||||
|
nameOf = path: replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString path));
|
||||||
forAllSystems = function:
|
forAllSystems = function:
|
||||||
nixpkgs.lib.genAttrs [
|
nixpkgs.lib.genAttrs [
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
@ -53,27 +54,27 @@
|
|||||||
|
|
||||||
nixosModules = listToAttrs (
|
nixosModules = listToAttrs (
|
||||||
map (file: {
|
map (file: {
|
||||||
name = replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString file));
|
name = nameOf file;
|
||||||
value = import file;
|
value = import file;
|
||||||
}) (listFilesRecursive ./modules)
|
}) (listFilesRecursive ./modules)
|
||||||
);
|
);
|
||||||
|
|
||||||
homeModules = listToAttrs (
|
homeModules = listToAttrs (
|
||||||
map (file: {
|
map (file: {
|
||||||
name = replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString file));
|
name = nameOf file;
|
||||||
value = import file;
|
value = import file;
|
||||||
}) (listFilesRecursive ./home)
|
}) (listFilesRecursive ./home)
|
||||||
);
|
);
|
||||||
|
|
||||||
overlays = listToAttrs (
|
overlays = listToAttrs (
|
||||||
map (file: {
|
map (file: {
|
||||||
name = replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString file));
|
name = nameOf file;
|
||||||
value = import file;
|
value = import file;
|
||||||
}) (listFilesRecursive ./overlays)
|
}) (listFilesRecursive ./overlays)
|
||||||
);
|
);
|
||||||
|
|
||||||
checks.x86_64-linux = listToAttrs (map (file: {
|
checks.x86_64-linux = listToAttrs (map (file: {
|
||||||
name = replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString file));
|
name = nameOf file;
|
||||||
|
|
||||||
value = import file {
|
value = import file {
|
||||||
inherit self;
|
inherit self;
|
||||||
|
Loading…
Reference in New Issue
Block a user