systemd: replace @ when generating unit command name
This commit is contained in:
parent
6a703aa570
commit
2fa662c957
|
@ -10,15 +10,19 @@ let
|
||||||
|
|
||||||
systemd = cfg.package;
|
systemd = cfg.package;
|
||||||
|
|
||||||
|
|
||||||
makeUnit = name: unit:
|
makeUnit = name: unit:
|
||||||
|
let
|
||||||
|
pathSafeName = lib.replaceChars ["@"] ["-"] name;
|
||||||
|
in
|
||||||
if unit.enable then
|
if unit.enable then
|
||||||
pkgs.runCommand "unit-${name}" { preferLocalBuild = true; inherit (unit) text; }
|
pkgs.runCommand "unit-${pathSafeName}" { preferLocalBuild = true; inherit (unit) text; }
|
||||||
''
|
''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
echo -n "$text" > $out/${shellEscape name}
|
echo -n "$text" > $out/${shellEscape name}
|
||||||
''
|
''
|
||||||
else
|
else
|
||||||
pkgs.runCommand "unit-${name}-disabled" { preferLocalBuild = true; }
|
pkgs.runCommand "unit-${pathSafeName}-disabled" { preferLocalBuild = true; }
|
||||||
''
|
''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
ln -s /dev/null $out/${shellEscape name}
|
ln -s /dev/null $out/${shellEscape name}
|
||||||
|
|
Loading…
Reference in New Issue