summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-18 17:38:06 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-18 17:38:06 +0200
commit1e540af43bce0e23d72b338f5c8359e73ae49f38 (patch)
tree3793e18c37402aad0c53db9aabaa3ded2b27c1b2 /nixos/modules/system
parent85fdaed9debd63624729d34cdc9ba4d8aa8cb689 (diff)
downloadnixlib-1e540af43bce0e23d72b338f5c8359e73ae49f38.tar
nixlib-1e540af43bce0e23d72b338f5c8359e73ae49f38.tar.gz
nixlib-1e540af43bce0e23d72b338f5c8359e73ae49f38.tar.bz2
nixlib-1e540af43bce0e23d72b338f5c8359e73ae49f38.tar.lz
nixlib-1e540af43bce0e23d72b338f5c8359e73ae49f38.tar.xz
nixlib-1e540af43bce0e23d72b338f5c8359e73ae49f38.tar.zst
nixlib-1e540af43bce0e23d72b338f5c8359e73ae49f38.zip
Fix broken upstream user unit symlinks
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/systemd.nix7
1 files changed, 6 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 20748f9c3eb5..f5d73ba665e9 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -379,7 +379,12 @@ let
         fn=${systemd}/example/systemd/${type}/$i
         if ! [ -e $fn ]; then echo "missing $fn"; false; fi
         if [ -L $fn ]; then
-          cp -pd $fn $out/
+          target="$(readlink "$fn")"
+          if [ ''${target:0:3} = ../ ]; then
+            ln -s "$(readlink -f "$fn")" $out/
+          else
+            cp -pd $fn $out/
+          fi
         else
           ln -s $fn $out/
         fi