diff options
Diffstat (limited to 'nixos/modules/system/boot/systemd-lib.nix')
-rw-r--r-- | nixos/modules/system/boot/systemd-lib.nix | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/systemd-lib.nix b/nixos/modules/system/boot/systemd-lib.nix index 2dbf15031a088..6051a42857494 100644 --- a/nixos/modules/system/boot/systemd-lib.nix +++ b/nixos/modules/system/boot/systemd-lib.nix @@ -182,7 +182,18 @@ in rec { # upstream unit. for i in ${toString (mapAttrsToList (n: v: v.unit) units)}; do fn=$(basename $i/*) - if [ -e $out/$fn ]; then + + case $fn in + # if file name is a template specialization, use the template's name + *@?*.service) + # remove @foo.service and replace it with @.service + ofn="''${fn%@*.service}@.service" + ;; + *) + ofn="$fn" + esac + + if [ -e $out/$ofn ]; then if [ "$(readlink -f $i/$fn)" = /dev/null ]; then ln -sfn /dev/null $out/$fn else |