summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2018-05-15 14:19:33 +0200
committerGitHub <noreply@github.com>2018-05-15 14:19:33 +0200
commitd5060ac3a78303c72335b649cb95908415895567 (patch)
tree3d4a25d664c34a54466fabbe60c979c76001009e /nixos/modules/system
parent91365cd23abc28395b78b53d67b280f5b159a906 (diff)
parentd614f32e7ac639fb2e562c1be66d1d84bb3c3ad5 (diff)
downloadnixpkgs-d5060ac3a78303c72335b649cb95908415895567.tar
nixpkgs-d5060ac3a78303c72335b649cb95908415895567.tar.gz
nixpkgs-d5060ac3a78303c72335b649cb95908415895567.tar.bz2
nixpkgs-d5060ac3a78303c72335b649cb95908415895567.tar.lz
nixpkgs-d5060ac3a78303c72335b649cb95908415895567.tar.xz
nixpkgs-d5060ac3a78303c72335b649cb95908415895567.tar.zst
nixpkgs-d5060ac3a78303c72335b649cb95908415895567.zip
Merge pull request #33371 from jtojnar/flatpak
Flatpak
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/systemd-lib.nix17
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