nixos/systemd-lib: fix conflict with dbus.service.d directory
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
This commit is contained in:
parent
e0a42d991c
commit
17dd7bcd89
|
@ -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,8 +137,14 @@ rec {
|
|||
for i in ${toString cfg.packages}; do
|
||||
for fn in $i/etc/systemd/${type}/* $i/lib/systemd/${type}/*; do
|
||||
if ! [[ "$fn" =~ .wants$ ]]; then
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue