mirror of
https://github.com/nix-community/home-manager
synced 2024-11-04 18:29:45 +01:00
systemd: sanitize unit derivation names
To allow a few special characters such as "@".
This is taken from
c414e5bd08/nixos/modules/system/boot/systemd-lib.nix (L14)
This commit is contained in:
parent
93f5fcae1e
commit
74811679b7
1 changed files with 8 additions and 2 deletions
|
@ -27,11 +27,17 @@ let
|
||||||
buildService = style: name: serviceCfg:
|
buildService = style: name: serviceCfg:
|
||||||
let
|
let
|
||||||
filename = "${name}.${style}";
|
filename = "${name}.${style}";
|
||||||
|
pathSafeName = lib.replaceChars ["@" ":" "\\" "[" "]"]
|
||||||
|
["-" "-" "-" "" "" ]
|
||||||
|
filename;
|
||||||
|
|
||||||
# Needed because systemd derives unit names from the ultimate
|
# Needed because systemd derives unit names from the ultimate
|
||||||
# link target.
|
# link target.
|
||||||
source = pkgs.writeTextDir filename (toSystemdIni serviceCfg)
|
source = pkgs.writeTextFile {
|
||||||
+ "/" + filename;
|
name = pathSafeName;
|
||||||
|
text = toSystemdIni serviceCfg;
|
||||||
|
destination = "/${filename}";
|
||||||
|
} + "/${filename}";
|
||||||
|
|
||||||
wantedBy = target:
|
wantedBy = target:
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue