diff --git a/lib/default.nix b/lib/default.nix index 6baea4de0413..3eb2ecc308a4 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -127,6 +127,7 @@ let bitXor bitNot boolToString + boolToYesNo mergeAttrs flip defaultTo diff --git a/lib/trivial.nix b/lib/trivial.nix index 7e4c5f549ee7..9c4deafb402c 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -240,6 +240,26 @@ in */ boolToString = b: if b then "true" else "false"; + /** + Converts a boolean to a string. + + This function uses the strings "yes" and "no" to represent + boolean values. + + # Inputs + + `b` + + : The boolean to convert + + # Type + + ``` + boolToYesNo :: bool -> string + ``` + */ + boolToYesNo = b: if b then "yes" else "no"; + /** Merge two attribute sets shallowly, right side trumps left