aboutsummaryrefslogtreecommitdiff
path: root/lib/strings.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/strings.nix')
-rw-r--r--lib/strings.nix18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/strings.nix b/lib/strings.nix
index f62ff6679ef5..5010d9159cb8 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -561,15 +561,17 @@ rec {
enableFeature false "shared"
=> "--disable-shared"
*/
- enableFeature = enable: feat: "--${if enable then "enable" else "disable"}-${feat}";
+ enableFeature = enable: feat:
+ assert isString feat; # e.g. passing openssl instead of "openssl"
+ "--${if enable then "enable" else "disable"}-${feat}";
/* Create an --{enable-<feat>=<value>,disable-<feat>} string that can be passed to
standard GNU Autoconf scripts.
Example:
- enableFeature true "shared" "foo"
+ enableFeatureAs true "shared" "foo"
=> "--enable-shared=foo"
- enableFeature false "shared" (throw "ignored")
+ enableFeatureAs false "shared" (throw "ignored")
=> "--disable-shared"
*/
enableFeatureAs = enable: feat: value: enableFeature enable feat + optionalString enable "=${value}";
@@ -583,15 +585,17 @@ rec {
withFeature false "shared"
=> "--without-shared"
*/
- withFeature = with_: feat: "--${if with_ then "with" else "without"}-${feat}";
+ withFeature = with_: feat:
+ assert isString feat; # e.g. passing openssl instead of "openssl"
+ "--${if with_ then "with" else "without"}-${feat}";
/* Create an --{with-<feat>=<value>,without-<feat>} string that can be passed to
standard GNU Autoconf scripts.
Example:
- with_Feature true "shared" "foo"
+ withFeatureAs true "shared" "foo"
=> "--with-shared=foo"
- with_Feature false "shared" (throw "ignored")
+ withFeatureAs false "shared" (throw "ignored")
=> "--without-shared"
*/
withFeatureAs = with_: feat: value: withFeature with_ feat + optionalString with_ "=${value}";
@@ -670,7 +674,7 @@ rec {
else
false;
- /* Parse a string string as an int.
+ /* Parse a string as an int.
Type: string -> int