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:
Donovan Glover 2024-04-01 04:12:21 -04:00
parent c421fe245f
commit 0c29329080
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -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
(builtins.map
(filename: {
name = builtins.replaceStrings [".nix"] [""] filename;
value = import ./${directory}/${filename}; })
(builtins.attrNames
(builtins.readDir ./${directory})))); })
["overlays" "nixosModules" "homeManagerModules"]));
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 = function ./${directory}/${filename}; })
(builtins.attrNames
(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"]));
}