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