mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-01-24 06:38:36 +01:00
meta(flake.nix): Add working DRY output generation
The code for this is extremely messy right now however it works and I'd rather not accidentally break it while refactoring, so this commit serves as documenting the working code.
This commit is contained in:
parent
c421fe245f
commit
0c29329080
25
flake.nix
25
flake.nix
@ -36,9 +36,6 @@
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
packages."x86_64-linux" = with nixpkgs.legacyPackages."x86_64-linux";
|
||||
builtins.mapAttrs (name: value: callPackage ./packages/${name}) (builtins.readDir ./packages);
|
||||
} //
|
||||
(builtins.listToAttrs
|
||||
(builtins.map
|
||||
@ -49,12 +46,26 @@
|
||||
["nixosModules" "homeManagerModules"]
|
||||
["modules" "home"]
|
||||
attr;
|
||||
in (builtins.listToAttrs
|
||||
function = if directory == "packages"
|
||||
then nixpkgs.legacyPackages.x86_64-linux.callPackage
|
||||
else import;
|
||||
filesMap = (builtins.listToAttrs
|
||||
(builtins.map
|
||||
(filename: {
|
||||
name = builtins.replaceStrings [".nix"] [""] filename;
|
||||
value = import ./${directory}/${filename}; })
|
||||
value = function ./${directory}/${filename}; })
|
||||
(builtins.attrNames
|
||||
(builtins.readDir ./${directory})))); })
|
||||
["overlays" "nixosModules" "homeManagerModules"]));
|
||||
(builtins.readDir ./${directory}))));
|
||||
callP = (builtins.listToAttrs
|
||||
(builtins.map
|
||||
(filename: {
|
||||
name = builtins.replaceStrings [".nix"] [""] filename;
|
||||
value = function ./${directory}/${filename} { }; })
|
||||
(builtins.attrNames
|
||||
(builtins.readDir ./${directory}))));
|
||||
val = if directory == "packages"
|
||||
then { x86_64-linux = callP; }
|
||||
else filesMap;
|
||||
in (val); })
|
||||
["overlays" "nixosModules" "homeManagerModules" "packages"]));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user