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

This commit is contained in:
Florian Klink
2026-05-03 13:30:39 +00:00
committed by GitHub
+3 -1
View File
@@ -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: