systemd: replace @ when generating unit command name

This commit is contained in:
Domen Kožar 2014-10-19 17:18:50 +02:00
parent 6a703aa570
commit 2fa662c957

View File

@ -10,15 +10,19 @@ let
systemd = cfg.package;
makeUnit = name: unit:
let
pathSafeName = lib.replaceChars ["@"] ["-"] name;
in
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
echo -n "$text" > $out/${shellEscape name}
''
else
pkgs.runCommand "unit-${name}-disabled" { preferLocalBuild = true; }
pkgs.runCommand "unit-${pathSafeName}-disabled" { preferLocalBuild = true; }
''
mkdir -p $out
ln -s /dev/null $out/${shellEscape name}