Skip to content

Commit

Permalink
Merge pull request #216737 from FedericoSchonborn/budgie
Browse files Browse the repository at this point in the history
Budgie Desktop
  • Loading branch information
bobby285271 authored Apr 3, 2023
2 parents 53dad94 + ce6f0af commit 28031f7
Show file tree
Hide file tree
Showing 13 changed files with 895 additions and 2 deletions.
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2305.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ In addition to numerous new and upgraded packages, this release has the followin

- [stevenblack-blocklist](https://github.com/StevenBlack/hosts), A unified hosts file with base extensions for blocking unwanted websites. Available as [networking.stevenblack](options.html#opt-networking.stevenblack.enable).

- [Budgie Desktop](https://github.com/BuddiesOfBudgie/budgie-desktop), a familiar, modern desktop environment. Availabe as [services.xserver.desktopManager.budgie](options.html#opt-services.xserver.desktopManager.budgie).

- [imaginary](https://github.com/h2non/imaginary), a microservice for high-level image processing that Nextcloud can use to generate previews. Available as [services.imaginary](#opt-services.imaginary.enable).

- [opensearch](https://opensearch.org), a search server alternative to Elasticsearch. Available as [services.opensearch](options.html#opt-services.opensearch.enable).
Expand Down
201 changes: 201 additions & 0 deletions nixos/modules/services/x11/desktop-managers/budgie.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
{ lib, pkgs, config, utils, ... }:

let
inherit (lib) concatMapStrings literalExpression mdDoc mkDefault mkEnableOption mkIf mkOption types;

cfg = config.services.xserver.desktopManager.budgie;

nixos-background-light = pkgs.nixos-artwork.wallpapers.nineish;
nixos-background-dark = pkgs.nixos-artwork.wallpapers.nineish-dark-gray;

nixos-gsettings-overrides = pkgs.budgie.budgie-gsettings-overrides.override {
inherit (cfg) extraGSettingsOverrides extraGSettingsOverridePackages;
inherit nixos-background-dark nixos-background-light;
};
in {
options = {
services.xserver.desktopManager.budgie = {
enable = mkEnableOption (mdDoc "Budgie desktop");

sessionPath = mkOption {
description = mdDoc "Additional list of packages to be added to the session search path. Useful for GSettings-conditional autostart.";
type = with types; listOf package;
example = literalExpression "[ pkgs.budgie.budgie-desktop-view ]";
default = [];
};

extraGSettingsOverrides = mkOption {
description = mdDoc "Additional GSettings overrides.";
type = types.lines;
default = "";
};

extraGSettingsOverridePackages = mkOption {
description = mdDoc "List of packages for which GSettings are overridden.";
type = with types; listOf path;
default = [];
};
};

environment.budgie.excludePackages = mkOption {
description = mdDoc "Which packages Budgie should exclude from the default environment.";
type = with types; listOf package;
default = [];
example = literalExpression "[ pkgs.mate-terminal ]";
};
};

config = mkIf cfg.enable {
services.xserver.displayManager.sessionPackages = with pkgs; [
budgie.budgie-desktop
];

services.xserver.displayManager.lightdm.greeters.slick = {
enable = mkDefault true;
theme = mkDefault { name = "Qogir"; package = pkgs.qogir-theme; };
iconTheme = mkDefault { name = "Qogir"; package = pkgs.qogir-icon-theme; };
cursorTheme = mkDefault { name = "Qogir"; package = pkgs.qogir-icon-theme; };
};

services.xserver.desktopManager.budgie.sessionPath = [ pkgs.budgie.budgie-desktop-view ];

environment.extraInit = ''
${concatMapStrings (p: ''
if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then
export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name}
fi
if [ -d "${p}/lib/girepository-1.0" ]; then
export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib
fi
'') cfg.sessionPath}
'';

environment.systemPackages = with pkgs;
[
# Budgie Desktop.
budgie.budgie-backgrounds
budgie.budgie-control-center
budgie.budgie-desktop
budgie.budgie-desktop-view
budgie.budgie-screensaver

# Required by the Budgie Desktop session.
(gnome.gnome-session.override {gnomeShellSupport = false;})

# Required by Budgie Menu.
gnome-menus

# Provides `gsettings`.
glib

# Update user directories.
xdg-user-dirs
]
++ (utils.removePackagesByName [
cinnamon.nemo
mate.eom
mate.pluma
mate.atril
mate.engrampa
mate.mate-calc
mate.mate-terminal
mate.mate-system-monitor
vlc

# Desktop themes.
qogir-theme
qogir-icon-theme

# Default settings.
nixos-gsettings-overrides
] config.environment.budgie.excludePackages)
++ cfg.sessionPath;

# Fonts.
fonts.fonts = mkDefault [
pkgs.noto-fonts
pkgs.hack-font
];
fonts.fontconfig.defaultFonts = {
sansSerif = mkDefault ["Noto Sans"];
monospace = mkDefault ["Hack"];
};

# Qt application style.
qt = {
enable = mkDefault true;
style = mkDefault "gtk2";
platformTheme = mkDefault "gtk2";
};

environment.pathsToLink = [
"/share" # TODO: https://github.com/NixOS/nixpkgs/issues/47173
];

# GSettings overrides.
environment.sessionVariables.NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-overrides}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas";

# Required by Budgie Desktop.
services.xserver.updateDbusEnvironment = true;
programs.dconf.enable = true;

# Required by Budgie Screensaver.
security.pam.services.budgie-screensaver = {};

# Required by Budgie's Polkit Dialog.
security.polkit.enable = mkDefault true;

# Required by Budgie Panel plugins and/or Budgie Control Center panels.
networking.networkmanager.enable = mkDefault true; # for BCC's Network panel.
programs.nm-applet.enable = config.networking.networkmanager.enable; # Budgie has no Network applet.
programs.nm-applet.indicator = false; # Budgie doesn't support AppIndicators.

hardware.bluetooth.enable = mkDefault true; # for Budgie's Status Indicator and BCC's Bluetooth panel.
hardware.pulseaudio.enable = mkDefault true; # for Budgie's Status Indicator and BCC's Sound panel.

xdg.portal.enable = mkDefault true; # for BCC's Applications panel.
xdg.portal.extraPortals = with pkgs; [
xdg-desktop-portal-gtk # provides a XDG Portals implementation.
];

services.geoclue2.enable = mkDefault true; # for BCC's Privacy > Location Services panel.
services.upower.enable = config.powerManagement.enable; # for Budgie's Status Indicator and BCC's Power panel.
services.xserver.libinput.enable = mkDefault true; # for BCC's Mouse panel.
services.colord.enable = mkDefault true; # for BCC's Color panel.
services.gnome.at-spi2-core.enable = mkDefault true; # for BCC's A11y panel.
services.accounts-daemon.enable = mkDefault true; # for BCC's Users panel.
services.fprintd.enable = mkDefault true; # for BCC's Users panel.
services.udisks2.enable = mkDefault true; # for BCC's Details panel.

# For BCC's Online Accounts panel.
services.gnome.gnome-online-accounts.enable = mkDefault true;
services.gnome.gnome-online-miners.enable = true;

# For BCC's Printers panel.
services.printing.enable = mkDefault true;
services.system-config-printer.enable = config.services.printing.enable;

# For BCC's Sharing panel.
services.dleyna-renderer.enable = mkDefault true;
services.dleyna-server.enable = mkDefault true;
services.gnome.gnome-user-share.enable = mkDefault true;
services.gnome.rygel.enable = mkDefault true;

# Other default services.
services.gnome.evolution-data-server.enable = mkDefault true;
services.gnome.glib-networking.enable = mkDefault true;
services.gnome.gnome-keyring.enable = mkDefault true;
services.gnome.gnome-settings-daemon.enable = mkDefault true;
services.gvfs.enable = mkDefault true;

# Register packages for DBus.
services.dbus.packages = with pkgs; [
budgie.budgie-control-center
];

# Shell integration for MATE Terminal.
programs.bash.vteIntegration = true;
programs.zsh.vteIntegration = true;
};
}
2 changes: 1 addition & 1 deletion nixos/modules/services/x11/desktop-managers/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ in
./none.nix ./xterm.nix ./phosh.nix ./xfce.nix ./plasma5.nix ./lumina.nix
./lxqt.nix ./enlightenment.nix ./gnome.nix ./retroarch.nix ./kodi.nix
./mate.nix ./pantheon.nix ./surf-display.nix ./cde.nix
./cinnamon.nix
./cinnamon.nix ./budgie.nix
];

options = {
Expand Down
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ in {
btrbk-doas = handleTest ./btrbk-doas.nix {};
btrbk-no-timer = handleTest ./btrbk-no-timer.nix {};
btrbk-section-order = handleTest ./btrbk-section-order.nix {};
budgie = handleTest ./budgie.nix {};
buildbot = handleTest ./buildbot.nix {};
buildkite-agents = handleTest ./buildkite-agents.nix {};
caddy = handleTest ./caddy.nix {};
Expand Down
51 changes: 51 additions & 0 deletions nixos/tests/budgie.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import ./make-test-python.nix ({ pkgs, lib, ... }: {
name = "budgie";

meta = with lib; {
maintainers = [ maintainers.federicoschonborn ];
};

nodes.machine = { ... }: {
imports = [
./common/user-account.nix
];

services.xserver.enable = true;

services.xserver.displayManager = {
lightdm.enable = true;
autoLogin = {
enable = true;
user = "alice";
};
};

services.xserver.desktopManager.budgie.enable = true;
};

testScript = { nodes, ... }:
let
user = nodes.machine.users.users.alice;
in
''
with subtest("Wait for login"):
machine.wait_for_x()
machine.wait_for_file("${user.home}/.Xauthority")
machine.succeed("xauth merge ${user.home}/.Xauthority")
with subtest("Check that logging in has given the user ownership of devices"):
machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}")
with subtest("Check if Budgie session components actually start"):
machine.wait_until_succeeds("pgrep budgie-daemon")
machine.wait_for_window("budgie-daemon")
machine.wait_until_succeeds("pgrep budgie-panel")
machine.wait_for_window("budgie-panel")
with subtest("Open MATE terminal"):
machine.succeed("su - ${user.name} -c 'DISPLAY=:0 mate-terminal >&2 &'")
machine.wait_for_window("Terminal")
machine.sleep(20)
machine.screenshot("screen")
'';
})
40 changes: 40 additions & 0 deletions pkgs/desktops/budgie/budgie-backgrounds/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ lib
, stdenv
, fetchFromGitHub
, imagemagick
, jhead
, meson
, ninja
}:

stdenv.mkDerivation rec {
pname = "budgie-backgrounds";
version = "0.1";

src = fetchFromGitHub {
owner = "BuddiesOfBudgie";
repo = "budgie-backgrounds";
rev = "v${version}";
hash = "sha256-pDFd+WvWOPgDoSffmX9mzjDQbhePsJV1wGqmPDcnOlw=";
};

nativeBuildInputs = [
imagemagick
jhead
meson
ninja
];

preConfigure = ''
chmod +x ./scripts/optimizeImage.sh
patchShebangs ./scripts/optimizeImage.sh
'';

meta = with lib; {
description = "The default background set for the Budgie Desktop";
homepage = "https://github.com/BuddiesOfBudgie/budgie-backgrounds";
platforms = platforms.linux;
maintainers = [ maintainers.federicoschonborn ];
license = licenses.cc0;
};
}
Loading

0 comments on commit 28031f7

Please sign in to comment.