1 { lib, pkgs, config, utils, ... }:
4 inherit (lib) concatMapStrings literalExpression mdDoc mkDefault mkEnableOption mkIf mkOption types;
6 cfg = config.services.xserver.desktopManager.budgie;
8 nixos-background-light = pkgs.nixos-artwork.wallpapers.nineish;
9 nixos-background-dark = pkgs.nixos-artwork.wallpapers.nineish-dark-gray;
11 nixos-gsettings-overrides = pkgs.budgie.budgie-gsettings-overrides.override {
12 inherit (cfg) extraGSettingsOverrides extraGSettingsOverridePackages;
13 inherit nixos-background-dark nixos-background-light;
16 nixos-background-info = pkgs.writeTextFile {
17 name = "nixos-background-info";
20 <!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
22 <wallpaper deleted="false">
24 <filename>${nixos-background-light.gnomeFilePath}</filename>
25 <options>zoom</options>
26 <shade_type>solid</shade_type>
27 <pcolor>#d1dcf8</pcolor>
28 <scolor>#e3ebfe</scolor>
30 <wallpaper deleted="false">
31 <name>Nineish Dark Gray</name>
32 <filename>${nixos-background-dark.gnomeFilePath}</filename>
33 <options>zoom</options>
34 <shade_type>solid</shade_type>
35 <pcolor>#151515</pcolor>
36 <scolor>#262626</scolor>
40 destination = "/share/gnome-background-properties/nixos.xml";
44 services.xserver.desktopManager.budgie = {
45 enable = mkEnableOption (mdDoc "the Budgie desktop");
47 sessionPath = mkOption {
48 description = lib.mdDoc ''
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).
54 type = types.listOf types.package;
56 example = literalExpression "[ pkgs.gnome.gpaste ]";
59 extraGSettingsOverrides = mkOption {
60 description = mdDoc "Additional GSettings overrides.";
65 extraGSettingsOverridePackages = mkOption {
66 description = mdDoc "List of packages for which GSettings are overridden.";
67 type = types.listOf types.path;
71 extraPlugins = mkOption {
72 description = mdDoc "Extra plugins for the Budgie desktop";
73 type = types.listOf types.package;
75 example = literalExpression "[ pkgs.budgiePlugins.budgie-analogue-clock-applet ]";
79 environment.budgie.excludePackages = mkOption {
80 description = mdDoc "Which packages Budgie should exclude from the default environment.";
81 type = types.listOf types.package;
83 example = literalExpression "[ pkgs.mate-terminal ]";
87 config = mkIf cfg.enable {
88 services.xserver.displayManager.sessionPackages = with pkgs; [
92 services.xserver.displayManager.lightdm.greeters.slick = {
93 enable = mkDefault true;
94 theme = mkDefault { name = "Qogir"; package = pkgs.qogir-theme; };
95 iconTheme = mkDefault { name = "Qogir"; package = pkgs.qogir-icon-theme; };
96 cursorTheme = mkDefault { name = "Qogir"; package = pkgs.qogir-icon-theme; };
99 services.xserver.desktopManager.budgie.sessionPath = [ pkgs.budgie.budgie-desktop-view ];
101 environment.extraInit = ''
102 ${concatMapStrings (p: ''
103 if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then
104 export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name}
106 if [ -d "${p}/lib/girepository-1.0" ]; then
107 export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0
108 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib
113 environment.systemPackages = with pkgs;
116 budgie.budgie-backgrounds
117 budgie.budgie-control-center
118 (budgie.budgie-desktop-with-plugins.override { plugins = cfg.extraPlugins; })
119 budgie.budgie-desktop-view
120 budgie.budgie-screensaver
122 # Required by the Budgie Desktop session.
123 (gnome.gnome-session.override { gnomeShellSupport = false; })
125 # Required by Budgie Menu.
128 # Required by Budgie Control Center.
131 # Provides `gsettings`.
134 # Update user directories.
137 ++ lib.optional config.networking.networkmanager.enable pkgs.networkmanagerapplet
138 ++ (utils.removePackagesByName [
146 mate.mate-system-monitor
152 nixos-background-info
155 nixos-gsettings-overrides
156 ] config.environment.budgie.excludePackages)
160 fonts.packages = mkDefault [
164 fonts.fontconfig.defaultFonts = {
165 sansSerif = mkDefault ["Noto Sans"];
166 monospace = mkDefault ["Hack"];
169 # Qt application style.
171 enable = mkDefault true;
172 style = mkDefault "gtk2";
173 platformTheme = mkDefault "gtk2";
176 environment.pathsToLink = [
177 "/share" # TODO: https://github.com/NixOS/nixpkgs/issues/47173
180 # GSettings overrides.
181 environment.sessionVariables.NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-overrides}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas";
183 # Required by Budgie Desktop.
184 services.xserver.updateDbusEnvironment = true;
185 programs.dconf.enable = true;
187 # Required by Budgie Screensaver.
188 security.pam.services.budgie-screensaver = {};
190 # Required by Budgie's Polkit Dialog.
191 security.polkit.enable = mkDefault true;
193 # Required by Budgie Panel plugins and/or Budgie Control Center panels.
194 networking.networkmanager.enable = mkDefault true; # for BCC's Network panel.
195 programs.nm-applet.enable = config.networking.networkmanager.enable; # Budgie has no Network applet.
196 programs.nm-applet.indicator = true; # Budgie uses AppIndicators.
198 hardware.bluetooth.enable = mkDefault true; # for Budgie's Status Indicator and BCC's Bluetooth panel.
199 hardware.pulseaudio.enable = mkDefault true; # for Budgie's Status Indicator and BCC's Sound panel.
201 xdg.portal.enable = mkDefault true; # for BCC's Applications panel.
202 xdg.portal.extraPortals = with pkgs; [
203 xdg-desktop-portal-gtk # provides a XDG Portals implementation.
205 xdg.portal.configPackages = mkDefault [ pkgs.budgie.budgie-desktop ];
207 services.geoclue2.enable = mkDefault true; # for BCC's Privacy > Location Services panel.
208 services.upower.enable = config.powerManagement.enable; # for Budgie's Status Indicator and BCC's Power panel.
209 services.xserver.libinput.enable = mkDefault true; # for BCC's Mouse panel.
210 services.colord.enable = mkDefault true; # for BCC's Color panel.
211 services.gnome.at-spi2-core.enable = mkDefault true; # for BCC's A11y panel.
212 services.accounts-daemon.enable = mkDefault true; # for BCC's Users panel.
213 services.fprintd.enable = mkDefault true; # for BCC's Users panel.
214 services.udisks2.enable = mkDefault true; # for BCC's Details panel.
216 # For BCC's Online Accounts panel.
217 services.gnome.gnome-online-accounts.enable = mkDefault true;
218 services.gnome.gnome-online-miners.enable = true;
220 # For BCC's Printers panel.
221 services.printing.enable = mkDefault true;
222 services.system-config-printer.enable = config.services.printing.enable;
224 # For BCC's Sharing panel.
225 services.dleyna-renderer.enable = mkDefault true;
226 services.dleyna-server.enable = mkDefault true;
227 services.gnome.gnome-user-share.enable = mkDefault true;
228 services.gnome.rygel.enable = mkDefault true;
230 # Other default services.
231 services.gnome.evolution-data-server.enable = mkDefault true;
232 services.gnome.glib-networking.enable = mkDefault true;
233 services.gnome.gnome-keyring.enable = mkDefault true;
234 services.gnome.gnome-settings-daemon.enable = mkDefault true;
235 services.gvfs.enable = mkDefault true;
237 # Register packages for DBus.
238 services.dbus.packages = with pkgs; [
239 budgie.budgie-control-center
242 # Register packages for udev.
243 services.udev.packages = with pkgs; [
247 # Shell integration for MATE Terminal.
248 programs.bash.vteIntegration = true;
249 programs.zsh.vteIntegration = true;