summaryrefslogtreecommitdiffstats
path: root/lib/strings.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2017-05-30 01:20:37 +0200
committerzimbatm <zimbatm@zimbatm.com>2017-05-30 00:20:37 +0100
commit2b0a8427e6995eefddf09919ad48a7887e999965 (patch)
treec4f195b0d65953b708398a7cb370f74cf826a165 /lib/strings.nix
parent4e88e82e065653f0ca3418aaa7b2af7cdcde8e15 (diff)
lib/string: make `isStorePath` total (#26216)
fix #9278
Diffstat (limited to 'lib/strings.nix')
-rw-r--r--lib/strings.nix7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/strings.nix b/lib/strings.nix
index d48624257cf0..1cc633c729dc 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -438,8 +438,13 @@ rec {
=> true
isStorePath pkgs.python
=> true
+ isStorePath [] || isStorePath 42 || isStorePath {} || …
+ => false
*/
- isStorePath = x: builtins.substring 0 1 (toString x) == "/" && dirOf (builtins.toPath x) == builtins.storeDir;
+ isStorePath = x:
+ builtins.isString x
+ && builtins.substring 0 1 (toString x) == "/"
+ && dirOf (builtins.toPath x) == builtins.storeDir;
/* Convert string to int
Obviously, it is a bit hacky to use fromJSON that way.