From 9e9b96f07343ceb3f012fb07b6d73e0916ca0a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Romildo=20Malaquias?= Date: Fri, 19 Apr 2019 10:42:17 -0300 Subject: [PATCH] nixos/deepin: install polkit local authority files in /etc --- .../services/desktops/deepin/deepin.nix | 6 +++++ pkgs/desktops/deepin/dde-api/default.nix | 26 ++++++++++++++----- pkgs/desktops/deepin/dde-daemon/default.nix | 17 +++++++++--- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/nixos/modules/services/desktops/deepin/deepin.nix b/nixos/modules/services/desktops/deepin/deepin.nix index 45098cd783b..75706250784 100644 --- a/nixos/modules/services/desktops/deepin/deepin.nix +++ b/nixos/modules/services/desktops/deepin/deepin.nix @@ -69,6 +69,12 @@ isSystemUser = true; }; + environment.etc = { + "polkit-1/localauthority/10-vendor.d/com.deepin.api.device.pkla".source = "${pkgs.deepin.dde-api}/etc/polkit-1/localauthority/10-vendor.d/com.deepin.api.device.pkla"; + "polkit-1/localauthority/10-vendor.d/com.deepin.daemon.Accounts.pkla".source = "${pkgs.deepin.dde-daemon}/etc/polkit-1/localauthority/10-vendor.d/com.deepin.daemon.Accounts.pkla"; + "polkit-1/localauthority/10-vendor.d/com.deepin.daemon.Grub2.pkla".source = "${pkgs.deepin.dde-daemon}/etc/polkit-1/localauthority/10-vendor.d/com.deepin.daemon.Grub2.pkla"; + }; + services.deepin.deepin-menu.enable = true; services.deepin.deepin-turbo.enable = true; }) diff --git a/pkgs/desktops/deepin/dde-api/default.nix b/pkgs/desktops/deepin/dde-api/default.nix index b0e908c847e..76c0861cb3a 100644 --- a/pkgs/desktops/deepin/dde-api/default.nix +++ b/pkgs/desktops/deepin/dde-api/default.nix @@ -68,15 +68,10 @@ buildGoPackage rec { rfkill # run xcur2png # run #locales # run (locale-helper needs locale-gen, which is unavailable on NixOS?) - ]; + ]; postPatch = '' - searchHardCodedPaths # debugging - - sed -i -e "s|/var|$out/var|" Makefile - - # TODO: confirm where to install grub themes - sed -i -e "s|/boot/grub|$out/boot/grub|" Makefile + searchHardCodedPaths # debugging fixPath $out /usr/lib/deepin-api \ lunar-calendar/main.go \ @@ -90,6 +85,19 @@ buildGoPackage rec { misc/systemd/system/deepin-shutdown-sound.service \ theme_thumb/gtk/gtk.go \ thumbnails/gtk/gtk.go + fixPath $out /boot/grub Makefile # TODO: confirm where to install grub themes + fixPath $out /var Makefile + + # This package wants to install polkit local authority files into + # /var/lib. Nix does not allow a package to install files into /var/lib + # because it is outside of the Nix store and should contain applications + # state information (persistent data modified by programs as they + # run). Polkit looks for them in both /etc/polkit-1 and + # /var/lib/polkit-1 (with /etc having priority over /var/lib). An + # work around is to install them to $out/etc and simlnk them to + # /etc in the deepin module. + + sed -i -e "s,/var/lib/polkit-1,/etc/polkit-1," Makefile ''; buildPhase = '' @@ -103,6 +111,10 @@ buildGoPackage rec { remove-references-to -t ${go} $out/bin/* $out/lib/deepin-api/* ''; + postFixup = '' + searchHardCodedPaths $out # debugging + ''; + passthru.updateScript = deepin.updateScript { inherit name; }; meta = with stdenv.lib; { diff --git a/pkgs/desktops/deepin/dde-daemon/default.nix b/pkgs/desktops/deepin/dde-daemon/default.nix index 4f6b0f4908b..c709c2894c4 100644 --- a/pkgs/desktops/deepin/dde-daemon/default.nix +++ b/pkgs/desktops/deepin/dde-daemon/default.nix @@ -66,7 +66,7 @@ buildGoPackage rec { ]; postPatch = '' - searchHardCodedPaths + searchHardCodedPaths # debugging patchShebangs network/nm_generator/gen_nm_consts.py fixPath $out /usr/share/dde/data launcher/manager.go dock/dock_manager_init.go @@ -78,12 +78,21 @@ buildGoPackage rec { fixPath ${deepin-wallpapers} /usr/share/wallpapers appearance/background/list.go accounts/user.go sed -i -e "s|{DESTDIR}/etc|{DESTDIR}$out/etc|" Makefile - sed -i -e "s|{DESTDIR}/var|{DESTDIR}$out/var|" Makefile sed -i -e "s|{DESTDIR}/lib|{DESTDIR}$out/lib|" Makefile + sed -i -e "s|{DESTDIR}/var|{DESTDIR}$out/var|" Makefile find -type f -exec sed -i -e "s,/usr/lib/deepin-daemon,$out/lib/deepin-daemon," {} + - searchHardCodedPaths + # This package wants to install polkit local authority files into + # /var/lib. Nix does not allow a package to install files into /var/lib + # because it is outside of the Nix store and should contain applications + # state information (persistent data modified by programs as they + # run). Polkit looks for them in both /etc/polkit-1 and + # /var/lib/polkit-1 (with /etc having priority over /var/lib). An + # work around is to install them to $out/etc and simlnk them to + # /etc in the deepin module. + + sed -i -e "s,/var/lib/polkit-1,/etc/polkit-1," Makefile ''; buildPhase = '' @@ -104,6 +113,8 @@ buildGoPackage rec { for binary in $out/lib/deepin-daemon/*; do wrapProgram $binary "''${gappsWrapperArgs[@]}" done + + searchHardCodedPaths $out # debugging ''; passthru.updateScript = deepin.updateScript { inherit name; };