3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #59943 from romildo/fix.deepin.modules

nixos/deepin: use only one module for deepin services
This commit is contained in:
José Romildo Malaquias 2019-05-05 20:52:13 -03:00 committed by GitHub
commit b4941a463e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 152 additions and 82 deletions

View file

@ -256,8 +256,7 @@
./services/databases/virtuoso.nix
./services/desktops/accountsservice.nix
./services/desktops/bamf.nix
./services/desktops/deepin/dde-daemon.nix
./services/desktops/deepin/deepin-menu.nix
./services/desktops/deepin/deepin.nix
./services/desktops/dleyna-renderer.nix
./services/desktops/dleyna-server.nix
./services/desktops/pantheon/contractor.nix

View file

@ -1,41 +0,0 @@
# dde-daemon
{ config, pkgs, lib, ... }:
{
###### interface
options = {
services.deepin.dde-daemon = {
enable = lib.mkEnableOption
"A daemon for handling Deepin Desktop Environment session settings";
};
};
###### implementation
config = lib.mkIf config.services.deepin.dde-daemon.enable {
environment.systemPackages = [ pkgs.deepin.dde-daemon ];
services.dbus.packages = [ pkgs.deepin.dde-daemon ];
systemd.packages = [ pkgs.deepin.dde-daemon ];
users.groups.dde-daemon = { };
users.users.dde-daemon = {
description = "Deepin daemon user";
group = "dde-daemon";
isSystemUser = true;
};
};
}

View file

@ -1,29 +0,0 @@
# deepin-menu
{ config, pkgs, lib, ... }:
{
###### interface
options = {
services.deepin.deepin-menu = {
enable = lib.mkEnableOption
"DBus service for unified menus in Deepin Desktop Environment";
};
};
###### implementation
config = lib.mkIf config.services.deepin.deepin-menu.enable {
services.dbus.packages = [ pkgs.deepin.deepin-menu ];
};
}

View file

@ -0,0 +1,118 @@
# deepin
{ config, pkgs, lib, ... }:
{
###### interface
options = {
services.deepin.core.enable = lib.mkEnableOption "
Basic dbus and systemd services, groups and users needed by the
Deepin Desktop Environment.
";
services.deepin.deepin-menu.enable = lib.mkEnableOption "
DBus service for unified menus in Deepin Desktop Environment.
";
services.deepin.deepin-turbo.enable = lib.mkEnableOption "
Turbo service for the Deepin Desktop Environment. It is a daemon
that helps to launch applications faster.
";
};
###### implementation
config = lib.mkMerge [
(lib.mkIf config.services.deepin.core.enable {
environment.systemPackages = [
pkgs.deepin.dde-api
pkgs.deepin.dde-calendar
pkgs.deepin.dde-daemon
pkgs.deepin.dde-dock
pkgs.deepin.dde-session-ui
pkgs.deepin.deepin-anything
pkgs.deepin.deepin-image-viewer
pkgs.deepin.deepin-screenshot
];
services.dbus.packages = [
pkgs.deepin.dde-api
pkgs.deepin.dde-calendar
pkgs.deepin.dde-daemon
pkgs.deepin.dde-dock
pkgs.deepin.dde-session-ui
pkgs.deepin.deepin-anything
pkgs.deepin.deepin-image-viewer
pkgs.deepin.deepin-screenshot
];
systemd.packages = [
pkgs.deepin.dde-api
pkgs.deepin.dde-daemon
pkgs.deepin.deepin-anything
];
boot.extraModulePackages = [ config.boot.kernelPackages.deepin-anything ];
boot.kernelModules = [ "vfs_monitor" ];
users.groups.deepin-sound-player = { };
users.users.deepin-sound-player = {
description = "Deepin sound player";
group = "deepin-sound-player";
isSystemUser = true;
};
users.groups.deepin-daemon = { };
users.users.deepin-daemon = {
description = "Deepin daemon user";
group = "deepin-daemon";
isSystemUser = true;
};
users.groups.deepin_anything_server = { };
users.users.deepin_anything_server = {
description = "Deepin Anything Server";
group = "deepin_anything_server";
isSystemUser = true;
};
security.pam.services.deepin-auth-keyboard.text = ''
# original at ${pkgs.deepin.dde-daemon}/etc/pam.d/deepin-auth-keyboard
auth [success=2 default=ignore] pam_lsass.so
auth [success=1 default=ignore] pam_unix.so nullok_secure try_first_pass
auth requisite pam_deny.so
auth required pam_permit.so
'';
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;
})
(lib.mkIf config.services.deepin.deepin-menu.enable {
services.dbus.packages = [ pkgs.deepin.deepin-menu ];
})
(lib.mkIf config.services.deepin.deepin-turbo.enable {
environment.systemPackages = [ pkgs.deepin.deepin-turbo ];
systemd.packages = [ pkgs.deepin.deepin-turbo ];
})
];
}

View file

@ -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; {

View file

@ -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; };