diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-08-06 19:55:42 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-08-07 03:09:57 +0200 |
commit | 214d4fb73cd5c2aab6718a38b35c8b5217f0f200 (patch) | |
tree | f78ea308807277211b91f5d692eedce3a842501d /lib/strings.nix | |
parent | fa7a0f24a4c8e02789be6b5c9c83c4c3ee6948a5 (diff) |
Allow options with type "package" to be store paths
For example, this allows writing nix.package = /nix/store/786mlvhd17xvcp2r4jmmay6jj4wj6b7f-nix-1.10pre4206_896428c; Also, document types.package in the manual.
Diffstat (limited to 'lib/strings.nix')
-rw-r--r-- | lib/strings.nix | 5 |
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; + } |