diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2018-01-03 11:57:29 +0100 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2018-05-15 13:28:30 +0200 |
commit | 17dd7bcd89d568596f52356624be82201ea84779 (patch) | |
tree | 1b590fef1d4a7d8df5bf55adf3790cdf030752cd /nixos/modules/system | |
parent | e0a42d991cd30d3ebbc592dda34de2260b843773 (diff) | |
download | nixpkgs-17dd7bcd89d568596f52356624be82201ea84779.tar nixpkgs-17dd7bcd89d568596f52356624be82201ea84779.tar.gz nixpkgs-17dd7bcd89d568596f52356624be82201ea84779.tar.bz2 nixpkgs-17dd7bcd89d568596f52356624be82201ea84779.tar.lz nixpkgs-17dd7bcd89d568596f52356624be82201ea84779.tar.xz nixpkgs-17dd7bcd89d568596f52356624be82201ea84779.tar.zst nixpkgs-17dd7bcd89d568596f52356624be82201ea84779.zip |
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
Diffstat (limited to 'nixos/modules/system')
-rw-r--r-- | nixos/modules/system/boot/systemd-lib.nix | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/nixos/modules/system/boot/systemd-lib.nix b/nixos/modules/system/boot/systemd-lib.nix index 7c01f8ea9b7..ae9ee8811f7 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 |