1 { config, lib, pkgs, utils, ... }:
6 xcfg = config.services.xserver;
7 cfg = xcfg.desktopManager.deepin;
9 nixos-gsettings-overrides = pkgs.deepin.dde-gsettings-schemas.override {
10 extraGSettingsOverridePackages = cfg.extraGSettingsOverridePackages;
11 extraGSettingsOverrides = cfg.extraGSettingsOverrides;
17 services.xserver.desktopManager.deepin = {
18 enable = mkEnableOption "Deepin desktop manager";
19 extraGSettingsOverrides = mkOption {
22 description = "Additional gsettings overrides.";
24 extraGSettingsOverridePackages = mkOption {
26 type = types.listOf types.path;
27 description = "List of packages for which gsettings are overridden.";
31 environment.deepin.excludePackages = mkOption {
33 type = types.listOf types.package;
34 description = "List of default packages to exclude from the configuration";
39 config = mkIf cfg.enable
41 services.displayManager.sessionPackages = [ pkgs.deepin.dde-session ];
42 services.displayManager.defaultSession = mkDefault "dde-x11";
44 # Update the DBus activation environment after launching the desktop manager.
45 services.xserver.displayManager.sessionCommands = ''
46 ${lib.getBin pkgs.dbus}/bin/dbus-update-activation-environment --systemd --all
49 hardware.bluetooth.enable = mkDefault true;
50 security.polkit.enable = true;
52 services.deepin.dde-daemon.enable = mkForce true;
53 services.deepin.dde-api.enable = mkForce true;
54 services.deepin.app-services.enable = mkForce true;
55 services.deepin.deepin-anything.enable = mkDefault true;
57 services.colord.enable = mkDefault true;
58 services.accounts-daemon.enable = mkDefault true;
59 services.gvfs.enable = mkDefault true;
60 services.gnome.glib-networking.enable = mkDefault true;
61 services.gnome.gnome-keyring.enable = mkDefault true;
62 services.bamf.enable = mkDefault true;
64 services.libinput.enable = mkDefault true;
65 services.udisks2.enable = true;
66 services.upower.enable = mkDefault config.powerManagement.enable;
67 networking.networkmanager.enable = mkDefault true;
68 programs.dconf.enable = mkDefault true;
69 programs.gnupg.agent.pinentryPackage = mkDefault pkgs.pinentry-qt;
71 fonts.packages = with pkgs; [ noto-fonts ];
72 xdg.mime.enable = true;
73 xdg.menus.enable = true;
74 xdg.icons.enable = true;
75 xdg.portal.enable = mkDefault true;
76 xdg.portal.extraPortals = mkDefault [
77 (pkgs.xdg-desktop-portal-gtk.override {
78 buildPortalsInGnome = false;
82 # https://github.com/NixOS/nixpkgs/pull/247766#issuecomment-1722839259
83 xdg.portal.config.deepin.default = mkDefault [ "gtk" ];
85 environment.sessionVariables = {
86 NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-overrides}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas";
87 DDE_POLKIT_AGENT_PLUGINS_DIRS = [ "${pkgs.deepin.dpa-ext-gnomekeyring}/lib/polkit-1-dde/plugins" ];
90 environment.pathsToLink = [
91 "/lib/dde-dock/plugins"
92 "/lib/dde-control-center"
93 "/lib/dde-session-shell"
94 "/lib/dde-file-manager"
99 "/share/deepin-themes"
105 "deepin-installer.conf".text = ''
106 system_info_vendor_name="Copyright (c) 2003-2024 NixOS contributors"
110 systemd.tmpfiles.rules = [
111 "d /var/lib/AccountsService 0775 root root - -"
112 "C /var/lib/AccountsService/icons 0775 root root - ${pkgs.deepin.dde-account-faces}/var/lib/AccountsService/icons"
115 security.pam.services.dde-lock.text = ''
116 # original at {dde-session-shell}/etc/pam.d/dde-lock
118 account include login
119 password substack login
120 session include login
123 environment.systemPackages = with pkgs; with deepin;
126 pciutils # for dtkcore/startdde
127 xdotool # for dde-daemon
128 glib # for gsettings program / gdbus
129 gtk3 # for gtk-launch program
130 xdg-user-dirs # Update user dirs
133 librsvg # dde-api use rsvg-convert
135 libsForQt5.kde-gtk-config # deepin-api/gtk-thumbnailer need
136 libsForQt5.kglobalaccel
137 xsettingsd # lightdm-deepin-greeter
169 deepin-desktop-schemas
175 dde-application-manager
176 deepin-service-manager
182 onboard # dde-dock plugin
190 deepin-system-monitor
191 deepin-shortcut-viewer
192 # freeimage has knownVulnerabilties, don't install packages using freeiamge by default
195 # deepin-image-viewer
196 # deepin-screen-recorder
200 ++ utils.removePackagesByName optionalPackages config.environment.deepin.excludePackages;
202 services.dbus.packages = with pkgs.deepin; [
216 dde-application-manager
217 deepin-service-manager
222 systemd.packages = with pkgs.deepin; [
232 dde-application-manager
233 deepin-service-manager