1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
npins ? import ../npins,
lib ? import "${(import ../npins).nixpkgs}/lib",
...
}:
let
# read the current directorys files and pipe the result through a list of functions
overlays = 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: {
inherit name;
value = import ./${name} { inherit npins; };
}))
# convert the resulting list to an attribute set
(builtins.listToAttrs)
];
in
overlays
// {
default = lib.flatten (builtins.attrValues overlays);
}