summary refs log tree commit diff
path: root/lib/strings.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/strings.nix')
-rw-r--r--lib/strings.nix5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/strings.nix b/lib/strings.nix
index bac03c9d7ad9d..e72bdc6d968c2 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -218,4 +218,9 @@ rec {
 
   # Format a number adding leading zeroes up to fixed width.
   fixedWidthNumber = width: n: fixedWidthString width "0" (toString n);
+
+
+  # Check whether a value is a store path.
+  isStorePath = x: builtins.substring 0 1 (toString x) == "/" && dirOf (builtins.toPath x) == builtins.storeDir;
+
 }