Unverified Commit f08b3d1f authored by Florian Klink's avatar Florian Klink Committed by GitHub
Browse files

nixos/lib/systemd-lib: make unitNameType work with e.g. Rust regex (#515527)

parents 7b70cce3 222ed185
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -67,7 +67,9 @@ rec {
  mkPathSafeName = 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)";
  # note: redundantly escaping backslash in the bracket expression makes the regex
  # slightly more portable even though POSIX doesn't require it.
  unitNameType = types.strMatching "[a-zA-Z0-9@%:_.\\\\-]+[.](service|socket|device|mount|automount|swap|target|path|timer|scope|slice)";

  makeUnit =
    name: unit: