summary refs log tree commit diff
path: root/lib/default.nix
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2022-04-27 10:02:49 +0200
committerNaïm Favier <n@monade.li>2022-04-27 16:04:17 +0200
commit226bc996597407aed9fced101234962a542d6bfd (patch)
tree66eb659558d367195a58c955e0df286679b47e40 /lib/default.nix
parent68322e1297ce606a37622186c85c7b60dd336a1c (diff)
downloadnixpkgs-226bc996597407aed9fced101234962a542d6bfd.tar
nixpkgs-226bc996597407aed9fced101234962a542d6bfd.tar.gz
nixpkgs-226bc996597407aed9fced101234962a542d6bfd.tar.bz2
nixpkgs-226bc996597407aed9fced101234962a542d6bfd.tar.lz
nixpkgs-226bc996597407aed9fced101234962a542d6bfd.tar.xz
nixpkgs-226bc996597407aed9fced101234962a542d6bfd.tar.zst
nixpkgs-226bc996597407aed9fced101234962a542d6bfd.zip
lib/strings: add toShellVars
A straightforward piece of plumbing to safely inject Nix variables into
shell scripts:

''
  ${lib.toShellVars { inherit foo bar; }}
  cmd "$foo" --bar "$bar"
''
Diffstat (limited to 'lib/default.nix')
-rw-r--r--lib/default.nix3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 1f06283790a..6327c8518ff 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -94,7 +94,8 @@ let
       concatImapStringsSep makeSearchPath makeSearchPathOutput
       makeLibraryPath makeBinPath optionalString
       hasInfix hasPrefix hasSuffix stringToCharacters stringAsChars escape
-      escapeShellArg escapeShellArgs escapeRegex escapeXML replaceChars lowerChars
+      escapeShellArg escapeShellArgs isValidPosixName toShellVar toShellVars
+      escapeRegex escapeXML replaceChars lowerChars
       upperChars toLower toUpper addContextFrom splitString
       removePrefix removeSuffix versionOlder versionAtLeast
       getName getVersion