grafana-alloy: don't build the frontend twice
[NixPkgs.git] / nixos / modules / services / x11 / desktop-managers / deepin.nix
blob70149bcf4ae08622e0dac672b1df441349f42299
1 { config, lib, pkgs, utils, ... }:
3 with lib;
5 let
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;
12   };
15   options = {
17     services.xserver.desktopManager.deepin = {
18       enable = mkEnableOption "Deepin desktop manager";
19       extraGSettingsOverrides = mkOption {
20         default = "";
21         type = types.lines;
22         description = "Additional gsettings overrides.";
23       };
24       extraGSettingsOverridePackages = mkOption {
25         default = [ ];
26         type = types.listOf types.path;
27         description = "List of packages for which gsettings are overridden.";
28       };
29     };
31     environment.deepin.excludePackages = mkOption {
32       default = [ ];
33       type = types.listOf types.package;
34       description = "List of default packages to exclude from the configuration";
35     };
37   };
39   config = mkIf cfg.enable
40     {
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
47       '';
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;
79         })
80       ];
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" ];
88       };
90       environment.pathsToLink = [
91         "/lib/dde-dock/plugins"
92         "/lib/dde-control-center"
93         "/lib/dde-session-shell"
94         "/lib/dde-file-manager"
95         "/share/backgrounds"
96         "/share/wallpapers"
97         "/share/dde-daemon"
98         "/share/dsg"
99         "/share/deepin-themes"
100         "/share/deepin"
101         "/share/dde-shell"
102       ];
104       environment.etc = {
105         "deepin-installer.conf".text = ''
106           system_info_vendor_name="Copyright (c) 2003-2024 NixOS contributors"
107         '';
108       };
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"
113       ];
115       security.pam.services.dde-lock.text = ''
116         # original at {dde-session-shell}/etc/pam.d/dde-lock
117         auth      substack      login
118         account   include       login
119         password  substack      login
120         session   include       login
121       '';
123       environment.systemPackages = with pkgs; with deepin;
124         let
125           requiredPackages = [
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
131             util-linux # runuser
132             polkit_gnome
133             librsvg # dde-api use rsvg-convert
134             lshw # for dtkcore
135             libsForQt5.kde-gtk-config # deepin-api/gtk-thumbnailer need
136             libsForQt5.kglobalaccel
137             xsettingsd # lightdm-deepin-greeter
138             dtkcommon
139             dtkcore
140             dtkgui
141             dtkwidget
142             dtkdeclarative
143             qt5platform-plugins
144             qt6platform-plugins
145             qt5integration
146             qt6integration
147             deepin-pw-check
149             dde-account-faces
150             deepin-icon-theme
151             deepin-desktop-theme
152             deepin-sound-theme
153             deepin-gtk-theme
154             deepin-wallpapers
155             deepin-desktop-base
157             startdde
158             dde-shell
159             dde-launchpad
160             dde-session-ui
161             dde-session-shell
162             dde-file-manager
163             dde-control-center
164             dde-network-core
165             dde-clipboard
166             dde-calendar
167             dde-polkit-agent
168             dpa-ext-gnomekeyring
169             deepin-desktop-schemas
170             deepin-terminal
171             deepin-kwin
172             dde-session
173             dde-widgets
174             dde-appearance
175             dde-application-manager
176             deepin-service-manager
177             dde-grand-search
178             dde-api-proxy
179             dde-tray-loader
180           ];
181           optionalPackages = [
182             onboard # dde-dock plugin
183             deepin-calculator
184             deepin-compressor
185             deepin-editor
186             deepin-picker
187             deepin-draw
188             deepin-music
189             deepin-movie-reborn
190             deepin-system-monitor
191             deepin-shortcut-viewer
192             # freeimage has knownVulnerabilties, don't install packages using freeiamge by default
193             # deepin-album
194             # deepin-camera
195             # deepin-image-viewer
196             # deepin-screen-recorder
197           ];
198         in
199         requiredPackages
200         ++ utils.removePackagesByName optionalPackages config.environment.deepin.excludePackages;
202       services.dbus.packages = with pkgs.deepin; [
203         dde-shell
204         dde-launchpad
205         dde-session-ui
206         dde-session-shell
207         dde-file-manager
208         dde-control-center
209         dde-calendar
210         dde-clipboard
211         deepin-kwin
212         deepin-pw-check
213         dde-widgets
214         dde-session
215         dde-appearance
216         dde-application-manager
217         deepin-service-manager
218         dde-grand-search
219         dde-api-proxy
220       ];
222       systemd.packages = with pkgs.deepin; [
223         dde-shell
224         dde-launchpad
225         dde-file-manager
226         dde-calendar
227         dde-clipboard
228         deepin-kwin
229         dde-appearance
230         dde-widgets
231         dde-session
232         dde-application-manager
233         deepin-service-manager
234         dde-api-proxy
235       ];
236     };