systemd: sanitize unit derivation names
To allow a few special characters such as "@". This is taken fromc414e5bd08/nixos/modules/system/boot/systemd-lib.nix (L14)
(cherry picked from commit74811679b7
)
This commit is contained in:
parent
8980e08240
commit
ee1bfa0d92
|
@ -27,11 +27,17 @@ let
|
|||
buildService = style: name: serviceCfg:
|
||||
let
|
||||
filename = "${name}.${style}";
|
||||
pathSafeName = lib.replaceChars ["@" ":" "\\" "[" "]"]
|
||||
["-" "-" "-" "" "" ]
|
||||
filename;
|
||||
|
||||
# Needed because systemd derives unit names from the ultimate
|
||||
# link target.
|
||||
source = pkgs.writeTextDir filename (toSystemdIni serviceCfg)
|
||||
+ "/" + filename;
|
||||
source = pkgs.writeTextFile {
|
||||
name = pathSafeName;
|
||||
text = toSystemdIni serviceCfg;
|
||||
destination = "/${filename}";
|
||||
} + "/${filename}";
|
||||
|
||||
wantedBy = target:
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue