From 2fa662c95796dd38ca801a104e45a34a214ffba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sun, 19 Oct 2014 17:18:50 +0200 Subject: [PATCH] systemd: replace @ when generating unit command name --- nixos/modules/system/boot/systemd.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 2a7985ded66..18dbed17a97 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -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}