1 { config, lib, utils, pkgs, ... }:
7 cfg = config.services.xserver.desktopManager.pantheon;
8 serviceCfg = config.services.pantheon;
10 nixos-gsettings-desktop-schemas = pkgs.pantheon.elementary-gsettings-schemas.override {
11 extraGSettingsOverridePackages = cfg.extraGSettingsOverridePackages;
12 extraGSettingsOverrides = cfg.extraGSettingsOverrides;
21 maintainers = teams.pantheon.members;
29 enable = mkEnableOption (lib.mdDoc "contractor, a desktop-wide extension service used by Pantheon");
32 apps.enable = mkEnableOption (lib.mdDoc "Pantheon default applications");
36 services.xserver.desktopManager.pantheon = {
40 description = lib.mdDoc "Enable the pantheon desktop manager";
43 sessionPath = mkOption {
45 type = types.listOf types.package;
46 example = literalExpression "[ pkgs.gnome.gpaste ]";
47 description = lib.mdDoc ''
48 Additional list of packages to be added to the session search path.
49 Useful for GSettings-conditional autostart.
51 Note that this should be a last resort; patching the package is preferred (see GPaste).
55 extraWingpanelIndicators = mkOption {
57 type = with types; nullOr (listOf package);
58 description = lib.mdDoc "Indicators to add to Wingpanel.";
61 extraSwitchboardPlugs = mkOption {
63 type = with types; nullOr (listOf package);
64 description = lib.mdDoc "Plugs to add to Switchboard.";
67 extraGSettingsOverrides = mkOption {
70 description = lib.mdDoc "Additional gsettings overrides.";
73 extraGSettingsOverridePackages = mkOption {
75 type = types.listOf types.path;
76 description = lib.mdDoc "List of packages for which gsettings are overridden.";
79 debug = mkEnableOption (lib.mdDoc "gnome-session debug messages");
83 environment.pantheon.excludePackages = mkOption {
85 example = literalExpression "[ pkgs.pantheon.elementary-camera ]";
86 type = types.listOf types.package;
87 description = lib.mdDoc "Which packages pantheon should exclude from the default environment";
95 services.xserver.desktopManager.pantheon.sessionPath = utils.removePackagesByName [
96 pkgs.pantheon.pantheon-agent-geoclue2
97 ] config.environment.pantheon.excludePackages;
99 services.xserver.displayManager.sessionPackages = [ pkgs.pantheon.elementary-session-settings ];
101 # Ensure lightdm is used when Pantheon is enabled
102 # Without it screen locking will be nonfunctional because of the use of lightlocker
103 warnings = optional (config.services.xserver.displayManager.lightdm.enable != true)
105 Using Pantheon without LightDM as a displayManager will break screenlocking from the UI.
108 services.xserver.displayManager.lightdm.greeters.pantheon.enable = mkDefault true;
110 # Without this, elementary LightDM greeter will pre-select non-existent `default` session
111 # https://github.com/elementary/greeter/issues/368
112 services.xserver.displayManager.defaultSession = mkDefault "pantheon";
114 services.xserver.displayManager.sessionCommands = ''
115 if test "$XDG_CURRENT_DESKTOP" = "Pantheon"; then
117 ${concatMapStrings (p: ''
118 if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then
119 export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name}
122 if [ -d "${p}/lib/girepository-1.0" ]; then
123 export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0
124 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib
131 hardware.bluetooth.enable = mkDefault true;
132 hardware.pulseaudio.enable = mkDefault true;
133 security.polkit.enable = true;
134 services.accounts-daemon.enable = true;
135 services.bamf.enable = true;
136 services.colord.enable = mkDefault true;
137 services.fwupd.enable = mkDefault true;
138 # TODO: Enable once #177946 is resolved
139 # services.packagekit.enable = mkDefault true;
140 services.power-profiles-daemon.enable = mkDefault true;
141 services.touchegg.enable = mkDefault true;
142 services.touchegg.package = pkgs.pantheon.touchegg;
143 services.tumbler.enable = mkDefault true;
144 services.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true));
145 services.dbus.packages = with pkgs.pantheon; [
146 switchboard-plug-power
147 elementary-default-settings # accountsservice extensions
149 services.pantheon.apps.enable = mkDefault true;
150 services.pantheon.contractor.enable = mkDefault true;
151 services.gnome.at-spi2-core.enable = true;
152 services.gnome.evolution-data-server.enable = true;
153 services.gnome.glib-networking.enable = true;
154 services.gnome.gnome-keyring.enable = true;
155 services.gvfs.enable = true;
156 services.gnome.rygel.enable = mkDefault true;
157 services.gsignond.enable = mkDefault true;
158 services.gsignond.plugins = with pkgs.gsignondPlugins; [ lastfm mail oauth ];
159 services.udisks2.enable = true;
160 services.upower.enable = config.powerManagement.enable;
161 services.xserver.libinput.enable = mkDefault true;
162 services.xserver.updateDbusEnvironment = true;
163 services.zeitgeist.enable = mkDefault true;
164 services.geoclue2.enable = mkDefault true;
165 # pantheon has pantheon-agent-geoclue2
166 services.geoclue2.enableDemoAgent = false;
167 services.geoclue2.appConfig."io.elementary.desktop.agent-geoclue2" = {
171 services.udev.packages = [
172 pkgs.pantheon.gnome-settings-daemon
173 # Force enable KMS modifiers for devices that require them.
174 # https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1443
178 pkgs.pantheon.gnome-settings-daemon
180 programs.dconf.enable = true;
181 networking.networkmanager.enable = mkDefault true;
184 environment.systemPackages = (with pkgs.pantheon; [
185 elementary-session-settings
186 elementary-settings-daemon
188 gnome-settings-daemon
189 (switchboard-with-plugs.override {
190 plugs = cfg.extraSwitchboardPlugs;
192 (wingpanel-with-indicators.override {
193 indicators = cfg.extraWingpanelIndicators;
195 ]) ++ utils.removePackagesByName ((with pkgs; [
197 glib # for gsettings program
199 gnome.adwaita-icon-theme
200 gtk3.out # for gtk-launch program
202 orca # elementary/greeter#668
203 sound-theme-freedesktop
204 xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/
205 ]) ++ (with pkgs.pantheon; [
208 elementary-icon-theme
209 elementary-sound-theme
210 elementary-wallpapers
213 elementary-default-settings
215 elementary-shortcut-overlay
218 elementary-capnet-assist
219 elementary-notifications
220 pantheon-agent-geoclue2
221 pantheon-agent-polkit
222 ])) config.environment.pantheon.excludePackages;
224 # Settings from elementary-default-settings
225 environment.etc."gtk-3.0/settings.ini".source = "${pkgs.pantheon.elementary-default-settings}/etc/gtk-3.0/settings.ini";
227 xdg.mime.enable = true;
228 xdg.icons.enable = true;
230 xdg.portal.enable = true;
231 xdg.portal.extraPortals = [
232 pkgs.xdg-desktop-portal-gtk
233 ] ++ (with pkgs.pantheon; [
235 elementary-settings-daemon
236 xdg-desktop-portal-pantheon
239 xdg.portal.configPackages = mkDefault [ pkgs.pantheon.elementary-default-settings ];
241 # Override GSettings schemas
242 environment.sessionVariables.NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-desktop-schemas}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas";
244 environment.sessionVariables.GNOME_SESSION_DEBUG = mkIf cfg.debug "1";
246 environment.pathsToLink = [
247 # FIXME: modules should link subdirs of `/share` rather than relying on this
251 # Otherwise you can't store NetworkManager Secrets with
252 # "Store the password only for this user"
253 programs.nm-applet.enable = true;
254 # Pantheon has its own network indicator
255 programs.nm-applet.indicator = false;
257 # Shell integration for VTE terminals
258 programs.bash.vteIntegration = mkDefault true;
259 programs.zsh.vteIntegration = mkDefault true;
261 # Use native GTK file chooser on Qt apps. This is because Qt does not know Pantheon.
262 # https://invent.kde.org/qt/qt/qtbase/-/blob/6.6/src/gui/platform/unix/qgenericunixthemes.cpp#L1312
263 # https://github.com/elementary/default-settings/blob/7.0.2/profile.d/qt-qpa-platformtheme.sh
264 environment.variables.QT_QPA_PLATFORMTHEME = mkDefault "gtk3";
267 fonts.packages = with pkgs; [
274 fonts.fontconfig.defaultFonts = {
275 monospace = [ "Roboto Mono" ];
276 sansSerif = [ "Inter" ];
280 (mkIf serviceCfg.apps.enable {
281 programs.evince.enable = mkDefault true;
282 programs.file-roller.enable = mkDefault true;
284 environment.systemPackages = utils.removePackagesByName ([
285 pkgs.gnome.gnome-font-viewer
286 ] ++ (with pkgs.pantheon; [
287 elementary-calculator
295 elementary-screenshot
300 ] ++ lib.optionals config.services.flatpak.enable [
301 # Only install appcenter if flatpak is enabled before
302 # https://github.com/NixOS/nixpkgs/issues/15932 is resolved.
305 ])) config.environment.pantheon.excludePackages;
307 # needed by screenshot
309 pkgs.pantheon.elementary-redacted-script
313 (mkIf serviceCfg.contractor.enable {
314 environment.systemPackages = with pkgs.pantheon; [
319 environment.pathsToLink = [