From 17dd7bcd89d568596f52356624be82201ea84779 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 3 Jan 2018 11:57:29 +0100 Subject: nixos/systemd-lib: fix conflict with dbus.service.d directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a package contains a directory in one of the systemd directories (like flatpak does), it is symlinked into the *-units derivation. Then later, the derivation will try to create the directory, which will fail: mkdir: cannot create directory '/nix/store/…-user-units/dbus.service.d': File exists builder for '/nix/store/…-user-units.drv' failed with exit code 1 Closes: #33233 --- nixos/modules/system/boot/systemd-lib.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'nixos/modules/system/boot') diff --git a/nixos/modules/system/boot/systemd-lib.nix b/nixos/modules/system/boot/systemd-lib.nix index 7c01f8ea9b7f..ae9ee8811f77 100644 --- a/nixos/modules/system/boot/systemd-lib.nix +++ b/nixos/modules/system/boot/systemd-lib.nix @@ -2,9 +2,10 @@ with lib; -let cfg = config.systemd; in - -rec { +let + cfg = config.systemd; + lndir = "${pkgs.xorg.lndir}/bin/lndir"; +in rec { shellEscape = s: (replaceChars [ "\\" ] [ "\\\\" ] s); @@ -136,7 +137,13 @@ rec { for i in ${toString cfg.packages}; do for fn in $i/etc/systemd/${type}/* $i/lib/systemd/${type}/*; do if ! [[ "$fn" =~ .wants$ ]]; then - ln -s $fn $out/ + if [[ -d "$fn" ]]; then + targetDir="$out/$(basename "$fn")" + mkdir -p "$targetDir" + ${lndir} "$fn" "$targetDir" + else + ln -s $fn $out/ + fi fi done done @@ -151,7 +158,7 @@ rec { if [ "$(readlink -f $i/$fn)" = /dev/null ]; then ln -sfn /dev/null $out/$fn else - mkdir $out/$fn.d + mkdir -p $out/$fn.d ln -s $i/$fn $out/$fn.d/overrides.conf fi else -- cgit 1.4.1