mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
parent
c049a09d1a
commit
604561ba9a
2 changed files with 9 additions and 4 deletions
|
@ -122,8 +122,9 @@ in rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
mkString = v:
|
mkString = v:
|
||||||
mkPrimitive type.string v // {
|
let sanitize = s: replaceStrings [ "\n" ] [ "\\n" ] (escape [ "'" "\\" ] s);
|
||||||
__toString = self: "'${escape [ "'" "\\" ] self.value}'";
|
in mkPrimitive type.string v // {
|
||||||
|
__toString = self: "'${sanitize self.value}'";
|
||||||
};
|
};
|
||||||
|
|
||||||
mkObjectpath = v:
|
mkObjectpath = v:
|
||||||
|
|
|
@ -26,7 +26,11 @@ in {
|
||||||
|
|
||||||
{ string = "foo"; }
|
{ string = "foo"; }
|
||||||
{ string = "foo"; }
|
{ string = "foo"; }
|
||||||
{ escapedString = "' \\"; }
|
{
|
||||||
|
escapedString = ''
|
||||||
|
'\
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
{ tuple = mkTuple [ 1 [ "foo" ] ]; }
|
{ tuple = mkTuple [ 1 [ "foo" ] ]; }
|
||||||
|
|
||||||
|
@ -47,7 +51,7 @@ in {
|
||||||
bool = true
|
bool = true
|
||||||
emptyArray1 = @as []
|
emptyArray1 = @as []
|
||||||
emptyArray2 = @as []
|
emptyArray2 = @as []
|
||||||
escapedString = '\' \\'
|
escapedString = '\'\\\n'
|
||||||
float = 3.140000
|
float = 3.140000
|
||||||
int = 42
|
int = 42
|
||||||
list = @as ['one','two']
|
list = @as ['one','two']
|
||||||
|
|
Loading…
Reference in a new issue