commit d3ba1a67dab28e976f170fde742903df9321f5ef
parent 8d4a270928805a1080ee0ae509dbde1bf59e2cfa
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Thu, 21 Aug 2025 17:28:28 +0200
parent 8d4a270928805a1080ee0ae509dbde1bf59e2cfa
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Thu, 21 Aug 2025 17:28:28 +0200
flake: collect overlays from `/overlays`
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/flake.nix b/flake.nix @@ -60,7 +60,7 @@ ); }; - overlays = { + overlays = (import ./overlays) // { nixpkgsUnstable = final: prev: { unstable = inputs.nixpkgsUnstable.legacyPackages.${prev.system}; };
diff --git a/overlays/default.nix b/overlays/default.nix @@ -0,0 +1,14 @@ +# read the current directorys files and pipe the result through a list of functions +builtins.foldl' (x: f: f x) (builtins.readDir ./.) [ + # convert to a list containing just the attribute names + (builtins.attrNames) + # drop "default.nix" from the list + (builtins.filter (name: name != "default.nix")) + # map the list to a name-value pair with a name that has the last 4 chars (".nix") stripped, and a value that is the contents of that given file + (builtins.map (name: { + name = builtins.substring 0 ((builtins.stringLength name) - 4) name; + value = import ./${name}; + })) + # convert the resulting list to an attribute set + (builtins.listToAttrs) +]