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 (lib.mdDoc "Deepin desktop manager");
19 extraGSettingsOverrides = mkOption {
22 description = lib.mdDoc "Additional gsettings overrides.";
24 extraGSettingsOverridePackages = mkOption {
26 type = types.listOf types.path;
27 description = lib.mdDoc "List of packages for which gsettings are overridden.";
31 environment.deepin.excludePackages = mkOption {
33 type = types.listOf types.package;
34 description = lib.mdDoc "List of default packages to exclude from the configuration";
39 config = mkIf cfg.enable
41 services.xserver.displayManager.sessionPackages = [ pkgs.deepin.startdde ];
42 services.xserver.displayManager.defaultSession = mkDefault "deepin";
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 hardware.pulseaudio.enable = mkDefault true;
51 security.polkit.enable = true;
53 services.deepin.dde-daemon.enable = mkForce true;
54 services.deepin.dde-api.enable = mkForce true;
55 services.deepin.app-services.enable = mkForce 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.xserver.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;
70 fonts.packages = with pkgs; [ noto-fonts ];
71 xdg.mime.enable = true;
72 xdg.menus.enable = true;
73 xdg.icons.enable = true;
74 xdg.portal.enable = mkDefault true;
75 xdg.portal.extraPortals = mkDefault [
76 (pkgs.xdg-desktop-portal-gtk.override {
77 buildPortalsInGnome = false;
81 # https://github.com/NixOS/nixpkgs/pull/247766#issuecomment-1722839259
82 xdg.portal.config.deepin.default = mkDefault [ "gtk" ];
84 environment.sessionVariables = {
85 NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-overrides}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas";
86 DDE_POLKIT_AGENT_PLUGINS_DIRS = [ "${pkgs.deepin.dpa-ext-gnomekeyring}/lib/polkit-1-dde/plugins" ];
89 environment.pathsToLink = [
90 "/lib/dde-dock/plugins"
91 "/lib/dde-control-center"
92 "/lib/dde-session-shell"
93 "/lib/dde-file-manager"
99 "distribution.info".text = ''
102 WebsiteName=www.nixos.org
103 Website=https://www.nixos.org
104 Logo=${pkgs.nixos-icons}/share/icons/hicolor/96x96/apps/nix-snowflake.png
105 LogoLight=${pkgs.nixos-icons}/share/icons/hicolor/32x32/apps/nix-snowflake.png
106 LogoTransparent=${pkgs.deepin.deepin-desktop-base}/share/pixmaps/distribution_logo_transparent.svg
108 "deepin-installer.conf".text = ''
109 system_info_vendor_name="Copyright (c) 2003-2023 NixOS contributors"
113 systemd.tmpfiles.rules = [
114 "d /var/lib/AccountsService 0775 root root - -"
115 "C /var/lib/AccountsService/icons 0775 root root - ${pkgs.deepin.dde-account-faces}/var/lib/AccountsService/icons"
118 security.pam.services.dde-lock.text = ''
119 # original at {dde-session-shell}/etc/pam.d/dde-lock
121 account include login
122 password substack login
123 session include login
126 environment.systemPackages = with pkgs; with deepin;
129 pciutils # for dtkcore/startdde
130 xdotool # for dde-daemon
131 glib # for gsettings program / gdbus
132 gtk3 # for gtk-launch program
133 xdg-user-dirs # Update user dirs
136 librsvg # dde-api use rsvg-convert
138 libsForQt5.kde-gtk-config # deepin-api/gtk-thumbnailer need
139 libsForQt5.kglobalaccel
140 xsettingsd # lightdm-deepin-greeter
163 deepin-desktop-schemas
169 onboard # dde-dock plugin
180 deepin-system-monitor
181 deepin-screen-recorder
182 deepin-shortcut-viewer
186 ++ utils.removePackagesByName optionalPackages config.environment.deepin.excludePackages;
188 services.dbus.packages = with pkgs.deepin; [
202 systemd.packages = with pkgs.deepin; [