summaryrefslogtreecommitdiffstats
path: root/nixos/lib
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2022-12-12 03:36:03 +0200
committerArtturin <Artturin@artturin.com>2022-12-15 22:25:51 +0200
commit05a2dfd6744cdc6ab0b57f8ab866cc686b05f519 (patch)
tree9fac9a1b33e1f3053479fe68f7b4ddca25852fac /nixos/lib
parent084fd6904550d915954791b6923e7a1ac4e9f3ec (diff)
lib.replaceChars: warn about being a deprecated alias
replaceStrings has been in nix since 2015(nix 1.10) so it is safe to remove the fallback https://github.com/nixos/nix/commit/d6d5885c1567454754a0d260521bafa0bd5e7fdb
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/systemd-lib.nix6
-rw-r--r--nixos/lib/utils.nix6
2 files changed, 6 insertions, 6 deletions
diff --git a/nixos/lib/systemd-lib.nix b/nixos/lib/systemd-lib.nix
index 4c52643446ed..c6c8753d5325 100644
--- a/nixos/lib/systemd-lib.nix
+++ b/nixos/lib/systemd-lib.nix
@@ -8,9 +8,9 @@ let
systemd = cfg.package;
in rec {
- shellEscape = s: (replaceChars [ "\\" ] [ "\\\\" ] s);
+ shellEscape = s: (replaceStrings [ "\\" ] [ "\\\\" ] s);
- mkPathSafeName = lib.replaceChars ["@" ":" "\\" "[" "]"] ["-" "-" "-" "" ""];
+ mkPathSafeName = lib.replaceStrings ["@" ":" "\\" "[" "]"] ["-" "-" "-" "" ""];
# a type for options that take a unit name
unitNameType = types.strMatching "[a-zA-Z0-9@%:_.\\-]+[.](service|socket|device|mount|automount|swap|target|path|timer|scope|slice)";
@@ -258,7 +258,7 @@ in rec {
makeJobScript = name: text:
let
- scriptName = replaceChars [ "\\" "@" ] [ "-" "_" ] (shellEscape name);
+ scriptName = replaceStrings [ "\\" "@" ] [ "-" "_" ] (shellEscape name);
out = (pkgs.writeShellScriptBin scriptName ''
set -e
${text}
diff --git a/nixos/lib/utils.nix b/nixos/lib/utils.nix
index 9eefa80d1c8b..def3aa13f320 100644
--- a/nixos/lib/utils.nix
+++ b/nixos/lib/utils.nix
@@ -48,7 +48,7 @@ rec {
trim = s: removeSuffix "/" (removePrefix "/" s);
normalizedPath = strings.normalizePath s;
in
- replaceChars ["/"] ["-"]
+ replaceStrings ["/"] ["-"]
(replacePrefix "." (strings.escapeC ["."] ".")
(strings.escapeC (stringToCharacters " !\"#$%&'()*+,;<=>=@[\\]^`{|}~-")
(if normalizedPath == "/" then normalizedPath else trim normalizedPath)));
@@ -67,7 +67,7 @@ rec {
else if builtins.isInt arg || builtins.isFloat arg then toString arg
else throw "escapeSystemdExecArg only allows strings, paths and numbers";
in
- replaceChars [ "%" "$" ] [ "%%" "$$" ] (builtins.toJSON s);
+ replaceStrings [ "%" "$" ] [ "%%" "$$" ] (builtins.toJSON s);
# Quotes a list of arguments into a single string for use in a Exec*
# line.
@@ -112,7 +112,7 @@ rec {
else if isAttrs item then
map (name:
let
- escapedName = ''"${replaceChars [''"'' "\\"] [''\"'' "\\\\"] name}"'';
+ escapedName = ''"${replaceStrings [''"'' "\\"] [''\"'' "\\\\"] name}"'';
in
recurse (prefix + "." + escapedName) item.${name}) (attrNames item)
else if isList item then