diff options
Diffstat (limited to 'nix/escapeExecline/default.nix')
-rw-r--r-- | nix/escapeExecline/default.nix | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/nix/escapeExecline/default.nix b/nix/escapeExecline/default.nix index deef5c2c4ec8..d2c39dd39894 100644 --- a/nix/escapeExecline/default.nix +++ b/nix/escapeExecline/default.nix @@ -16,14 +16,17 @@ let # escapeExecline [ "if" [ "somecommand" ] "true" ] # == ''"if" { "somecommand" } "true"'' escapeExecline = execlineList: lib.concatStringsSep " " - (let - go = arg: - if builtins.isString arg then [(escapeExeclineArg arg)] - else if builtins.isPath arg then [(escapeExeclineArg "${arg}")] - else if lib.isDerivation arg then [(escapeExeclineArg arg)] - else if builtins.isList arg then [ "{" ] ++ builtins.concatMap go arg ++ [ "}" ] - else abort "escapeExecline can only hande nested lists of strings, was ${lib.generators.toPretty {} arg}"; - in builtins.concatMap go execlineList); + ( + let + go = arg: + if builtins.isString arg then [ (escapeExeclineArg arg) ] + else if builtins.isPath arg then [ (escapeExeclineArg "${arg}") ] + else if lib.isDerivation arg then [ (escapeExeclineArg arg) ] + else if builtins.isList arg then [ "{" ] ++ builtins.concatMap go arg ++ [ "}" ] + else abort "escapeExecline can only hande nested lists of strings, was ${lib.generators.toPretty {} arg}"; + in + builtins.concatMap go execlineList + ); in escapeExecline |