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;
15 notExcluded = pkg: (!(lib.elem pkg config.environment.pantheon.excludePackages));
22 maintainers = teams.pantheon.members;
30 enable = mkEnableOption "contractor, a desktop-wide extension service used by Pantheon";
33 apps.enable = mkEnableOption "Pantheon default applications";
37 services.xserver.desktopManager.pantheon = {
41 description = "Enable the pantheon desktop manager";
44 sessionPath = mkOption {
46 type = types.listOf types.package;
47 example = literalExpression "[ pkgs.gpaste ]";
49 Additional list of packages to be added to the session search path.
50 Useful for GSettings-conditional autostart.
52 Note that this should be a last resort; patching the package is preferred (see GPaste).
56 extraWingpanelIndicators = mkOption {
58 type = with types; nullOr (listOf package);
59 description = "Indicators to add to Wingpanel.";
62 extraSwitchboardPlugs = mkOption {
64 type = with types; nullOr (listOf package);
65 description = "Plugs to add to Switchboard.";
68 extraGSettingsOverrides = mkOption {
71 description = "Additional gsettings overrides.";
74 extraGSettingsOverridePackages = mkOption {
76 type = types.listOf types.path;
77 description = "List of packages for which gsettings are overridden.";
80 debug = mkEnableOption "gnome-session debug messages";
84 environment.pantheon.excludePackages = mkOption {
86 example = literalExpression "[ pkgs.pantheon.elementary-camera ]";
87 type = types.listOf types.package;
88 description = "Which packages pantheon should exclude from the default environment";
96 services.xserver.desktopManager.pantheon.sessionPath = utils.removePackagesByName [
97 pkgs.pantheon.pantheon-agent-geoclue2
98 ] config.environment.pantheon.excludePackages;
100 services.displayManager.sessionPackages = [ pkgs.pantheon.elementary-session-settings ];
102 # Ensure lightdm is used when Pantheon is enabled
103 # Without it screen locking will be nonfunctional because of the use of lightlocker
104 warnings = optional (config.services.xserver.displayManager.lightdm.enable != true)
106 Using Pantheon without LightDM as a displayManager will break screenlocking from the UI.
109 services.xserver.displayManager.lightdm.greeters.pantheon.enable = mkDefault true;
111 # Without this, elementary LightDM greeter will pre-select non-existent `default` session
112 # https://github.com/elementary/greeter/issues/368
113 services.displayManager.defaultSession = mkDefault "pantheon";
115 services.xserver.displayManager.sessionCommands = ''
116 if test "$XDG_CURRENT_DESKTOP" = "Pantheon"; then
118 ${concatMapStrings (p: ''
119 if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then
120 export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name}
123 if [ -d "${p}/lib/girepository-1.0" ]; then
124 export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0
125 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib
132 hardware.bluetooth.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.libinput.enable = mkDefault true;
162 services.switcherooControl.enable = mkDefault true;
163 services.xserver.updateDbusEnvironment = true;
164 services.zeitgeist.enable = mkDefault true;
165 services.geoclue2.enable = mkDefault true;
166 # pantheon has pantheon-agent-geoclue2
167 services.geoclue2.enableDemoAgent = false;
168 services.geoclue2.appConfig."io.elementary.desktop.agent-geoclue2" = {
172 services.udev.packages = [
173 pkgs.pantheon.gnome-settings-daemon
174 # Force enable KMS modifiers for devices that require them.
175 # https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1443
178 services.orca.enable = mkDefault (notExcluded pkgs.orca);
179 systemd.packages = with pkgs; [
182 pantheon.gnome-settings-daemon
183 pantheon.elementary-session-settings
185 programs.dconf.enable = true;
186 networking.networkmanager.enable = mkDefault true;
188 systemd.user.targets."gnome-session-x11-services".wants = [
189 "org.gnome.SettingsDaemon.XSettings.service"
191 systemd.user.targets."gnome-session-x11-services-ready".wants = [
192 "org.gnome.SettingsDaemon.XSettings.service"
196 environment.systemPackages = (with pkgs.pantheon; [
197 elementary-bluetooth-daemon
198 elementary-session-settings
199 elementary-settings-daemon
201 gnome-settings-daemon
202 (switchboard-with-plugs.override {
203 plugs = cfg.extraSwitchboardPlugs;
205 (wingpanel-with-indicators.override {
206 indicators = cfg.extraWingpanelIndicators;
208 ]) ++ utils.removePackagesByName ((with pkgs; [
210 glib # for gsettings program
213 gtk3.out # for gtk-launch program
215 sound-theme-freedesktop
216 xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/
217 ]) ++ (with pkgs.pantheon; [
220 elementary-icon-theme
221 elementary-sound-theme
222 elementary-wallpapers
225 elementary-default-settings
227 elementary-shortcut-overlay
230 elementary-capnet-assist
231 elementary-notifications
232 pantheon-agent-geoclue2
233 pantheon-agent-polkit
234 ])) config.environment.pantheon.excludePackages;
236 # Settings from elementary-default-settings
237 environment.etc."gtk-3.0/settings.ini".source = "${pkgs.pantheon.elementary-default-settings}/etc/gtk-3.0/settings.ini";
239 xdg.mime.enable = true;
240 xdg.icons.enable = true;
242 xdg.portal.enable = true;
243 xdg.portal.extraPortals = [
244 pkgs.xdg-desktop-portal-gtk
245 ] ++ (with pkgs.pantheon; [
247 elementary-settings-daemon
248 xdg-desktop-portal-pantheon
251 xdg.portal.configPackages = mkDefault [ pkgs.pantheon.elementary-default-settings ];
253 # Override GSettings schemas
254 environment.sessionVariables.NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-desktop-schemas}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas";
256 environment.sessionVariables.GNOME_SESSION_DEBUG = mkIf cfg.debug "1";
258 environment.pathsToLink = [
259 # FIXME: modules should link subdirs of `/share` rather than relying on this
263 # Otherwise you can't store NetworkManager Secrets with
264 # "Store the password only for this user"
265 programs.nm-applet.enable = true;
266 # Pantheon has its own network indicator
267 programs.nm-applet.indicator = false;
269 # Shell integration for VTE terminals
270 programs.bash.vteIntegration = mkDefault true;
271 programs.zsh.vteIntegration = mkDefault true;
274 fonts.packages = with pkgs; [
281 fonts.fontconfig.defaultFonts = {
282 monospace = [ "Roboto Mono" ];
283 sansSerif = [ "Inter" ];
287 (mkIf serviceCfg.apps.enable {
288 programs.evince.enable = mkDefault (notExcluded pkgs.evince);
289 programs.file-roller.enable = mkDefault (notExcluded pkgs.file-roller);
291 environment.systemPackages = utils.removePackagesByName ([
292 pkgs.gnome-font-viewer
293 ] ++ (with pkgs.pantheon; [
294 elementary-calculator
302 elementary-screenshot
307 ] ++ lib.optionals config.services.flatpak.enable [
308 # Only install appcenter if flatpak is enabled before
309 # https://github.com/NixOS/nixpkgs/issues/15932 is resolved.
312 ])) config.environment.pantheon.excludePackages;
314 # needed by screenshot
316 pkgs.pantheon.elementary-redacted-script
320 (mkIf serviceCfg.contractor.enable {
321 environment.systemPackages = with pkgs.pantheon; [
326 environment.pathsToLink = [