diff options
Diffstat (limited to 'nixpkgs/lib/generators.nix')
-rw-r--r-- | nixpkgs/lib/generators.nix | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/nixpkgs/lib/generators.nix b/nixpkgs/lib/generators.nix index 0368577d5a51..8e93ed04916e 100644 --- a/nixpkgs/lib/generators.nix +++ b/nixpkgs/lib/generators.nix @@ -189,10 +189,10 @@ rec { * } * *> [url "ssh://git@github.com/"] - *> insteadOf = https://github.com/ + *> insteadOf = "https://github.com" *> *> [user] - *> name = edolstra + *> name = "edolstra" */ toGitINI = attrs: with builtins; @@ -209,9 +209,17 @@ rec { else ''${section} "${subsection}"''; + mkValueString = v: + let + escapedV = '' + "${ + replaceStrings [ "\n" " " ''"'' "\\" ] [ "\\n" "\\t" ''\"'' "\\\\" ] v + }"''; + in mkValueStringDefault { } (if isString v then escapedV else v); + # generation for multiple ini values mkKeyValue = k: v: - let mkKeyValue = mkKeyValueDefault { } " = " k; + let mkKeyValue = mkKeyValueDefault { inherit mkValueString; } " = " k; in concatStringsSep "\n" (map (kv: "\t" + mkKeyValue kv) (lib.toList v)); # converts { a.b.c = 5; } to { "a.b".c = 5; } for toINI |