about summary refs log tree commit diff
path: root/lib/filesystem.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/filesystem.nix')
-rw-r--r--lib/filesystem.nix10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/filesystem.nix b/lib/filesystem.nix
index 2d8a62639ec9..f604eb90434b 100644
--- a/lib/filesystem.nix
+++ b/lib/filesystem.nix
@@ -3,7 +3,6 @@
 
 let
   inherit (builtins)
-    getAttr
     readDir
     pathExists
     ;
@@ -22,17 +21,20 @@ in
   /*
     Returns the type of a path: regular (for file), symlink, or directory.
   */
-  pathType = path: getAttr (baseNameOf path) (readDir (dirOf path));
+  pathType = path:
+    (readDir (dirOf path)).${baseNameOf path};
 
   /*
     Returns true if the path exists and is a directory, false otherwise.
   */
-  pathIsDirectory = path: if pathExists path then (pathType path) == "directory" else false;
+  pathIsDirectory = path:
+    pathExists path && pathType path == "directory";
 
   /*
     Returns true if the path exists and is a regular file, false otherwise.
   */
-  pathIsRegularFile = path: if pathExists path then (pathType path) == "regular" else false;
+  pathIsRegularFile = path:
+    pathExists path && pathType path == "regular";
 
   /*
     A map of all haskell packages defined in the given path,