aboutsummaryrefslogtreecommitdiff
path: root/nix/directory.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix/directory.nix')
-rw-r--r--nix/directory.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/nix/directory.nix b/nix/directory.nix
new file mode 100644
index 0000000..980c718
--- /dev/null
+++ b/nix/directory.nix
@@ -0,0 +1,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 {});
+}