aboutsummaryrefslogtreecommitdiff
path: root/nix/directory.nix
blob: 980c718cbc44e671f24a34c333f8c860e1ee3c7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{ callPackage }:

with builtins;
rec {
  listDirectory = action: dir:
    let
      list = readDir dir;
    in listToAttrs (map
      (name: {
        name = replaceStrings [".nix"] [""] name;
        value = action (dir + ("/" + name));
      })
      (attrNames list));

  pathDirectory = listDirectory (x: x);
  importDirectory = listDirectory import;
  callDirectory = listDirectory (p: callPackage p {});
}