1
2
3
4
5
6
7
8
9
10
11
12
13
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: {
inherit name;
value = import ./${name};
}))
# convert the resulting list to an attribute set
(builtins.listToAttrs)
]