nixos/gnome3: split up

This introduces the following options under the services.gnome3 namespace:

* core-os-services.enable
* core-shell.enable
* core-utilities.enable
* games.enable

The first three are all default enabled by gnome3.enable
and their purpose is to make gnome3 more flexable for users
usecases. In the case of core-utilities and games, it allows
users to easily switch on the default gnome3 applications
and games packages. Previously we had lists in gnome-3/default.nix
but they weren't visible to the user. By having options we have
generated documentation and an interface.
This commit is contained in:
worldofpeace 2019-08-25 18:52:38 -04:00
parent af9f401b9a
commit fca8d35531
2 changed files with 172 additions and 141 deletions

View File

@ -3,7 +3,9 @@
with lib; with lib;
let let
cfg = config.services.xserver.desktopManager.gnome3; cfg = config.services.xserver.desktopManager.gnome3;
serviceCfg = config.services.gnome3;
# Prioritize nautilus by default when opening directories # Prioritize nautilus by default when opening directories
mimeAppsList = pkgs.writeTextFile { mimeAppsList = pkgs.writeTextFile {
@ -45,10 +47,19 @@ let
flashbackEnabled = cfg.flashback.enableMetacity || length cfg.flashback.customSessions > 0; flashbackEnabled = cfg.flashback.enableMetacity || length cfg.flashback.customSessions > 0;
in { in
{
options = { options = {
services.gnome3 = {
core-os-services.enable = mkEnableOption "essential services for GNOME3";
core-shell.enable = mkEnableOption "GNOME Shell services";
core-utilities.enable = mkEnableOption "GNOME core utilities";
games.enable = mkEnableOption "GNOME games";
};
services.xserver.desktopManager.gnome3 = { services.xserver.desktopManager.gnome3 = {
enable = mkOption { enable = mkOption {
default = false; default = false;
@ -121,62 +132,13 @@ in {
}; };
config = mkIf cfg.enable { config = mkMerge [
(mkIf cfg.enable {
services.gnome3.core-os-services.enable = true;
services.gnome3.core-shell.enable = true;
services.gnome3.core-utilities.enable = mkDefault true;
# Enable helpful DBus services. services.xserver.displayManager.extraSessionFilePackages = [ pkgs.gnome3.gnome-session ]
security.polkit.enable = true;
services.udisks2.enable = true;
services.accounts-daemon.enable = true;
services.dleyna-renderer.enable = mkDefault true;
services.dleyna-server.enable = mkDefault true;
services.gnome3.at-spi2-core.enable = true;
services.gnome3.evolution-data-server.enable = true;
services.gnome3.glib-networking.enable = true;
services.gnome3.gnome-keyring.enable = true;
services.gnome3.gnome-online-accounts.enable = mkDefault true;
services.gnome3.gnome-remote-desktop.enable = mkDefault true;
services.gnome3.gnome-settings-daemon.enable = true;
services.gnome3.gnome-user-share.enable = mkDefault true;
services.gvfs.enable = true;
services.gnome3.rygel.enable = mkDefault true;
services.gnome3.seahorse.enable = mkDefault true;
services.gnome3.sushi.enable = mkDefault true;
services.gnome3.tracker.enable = mkDefault true;
services.gnome3.tracker-miners.enable = mkDefault true;
hardware.pulseaudio.enable = mkDefault true;
services.telepathy.enable = mkDefault true;
networking.networkmanager.enable = mkDefault true;
services.upower.enable = config.powerManagement.enable;
services.dbus.packages =
optional config.services.printing.enable pkgs.system-config-printer ++
optional flashbackEnabled pkgs.gnome3.gnome-screensaver;
services.colord.enable = mkDefault true;
services.packagekit.enable = mkDefault true;
hardware.bluetooth.enable = mkDefault true;
services.hardware.bolt.enable = mkDefault true;
services.xserver.libinput.enable = mkDefault true; # for controlling touchpad settings via gnome control center
systemd.packages = [ pkgs.gnome3.vino ];
xdg.portal.enable = true;
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
# Enable default programs
programs.dconf.enable = true;
programs.evince.enable = mkDefault true;
programs.file-roller.enable = mkDefault true;
programs.gnome-disks.enable = mkDefault true;
programs.gnome-documents.enable = mkDefault true;
programs.gnome-terminal.enable = mkDefault true;
# If gnome3 is installed, build vim for gtk3 too.
nixpkgs.config.vim.gui = "gtk3";
fonts.fonts = [
pkgs.dejavu_fonts pkgs.cantarell-fonts
pkgs.source-sans-pro
pkgs.source-code-pro # Default monospace font in 3.32
];
services.xserver.displayManager.extraSessionFilePackages = [ pkgs.gnome3.gnome-session ]
++ map ++ map
(wm: pkgs.gnome3.gnome-flashback.mkSessionForWm { (wm: pkgs.gnome3.gnome-flashback.mkSessionForWm {
inherit (wm) wmName wmLabel wmCommand; inherit (wm) wmName wmLabel wmCommand;
@ -186,73 +148,172 @@ in {
wmCommand = "${pkgs.gnome3.metacity}/bin/metacity"; wmCommand = "${pkgs.gnome3.metacity}/bin/metacity";
} ++ cfg.flashback.customSessions); } ++ cfg.flashback.customSessions);
environment.extraInit = '' environment.extraInit = ''
${concatMapStrings (p: '' ${concatMapStrings (p: ''
if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then 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} export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name}
fi fi
if [ -d "${p}/lib/girepository-1.0" ]; then if [ -d "${p}/lib/girepository-1.0" ]; then
export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0 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 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib
fi fi
'') cfg.sessionPath} '') cfg.sessionPath}
''; '';
environment.systemPackages = cfg.sessionPath;
services.geoclue2.enable = mkDefault true; environment.variables.GNOME_SESSION_DEBUG = mkIf cfg.debug "1";
# GNOME should have its own geoclue agent
services.geoclue2.enableDemoAgent = false;
services.geoclue2.appConfig."gnome-datetime-panel" = { # Override GSettings schemas
isAllowed = true; environment.variables.NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-desktop-schemas}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas";
isSystem = true;
};
services.geoclue2.appConfig."gnome-color-panel" = {
isAllowed = true;
isSystem = true;
};
services.geoclue2.appConfig."org.gnome.Shell" = {
isAllowed = true;
isSystem = true;
};
environment.variables.GNOME_SESSION_DEBUG = optionalString cfg.debug "1"; # If gnome3 is installed, build vim for gtk3 too.
nixpkgs.config.vim.gui = "gtk3";
})
# Override default mimeapps (mkIf serviceCfg.core-os-services.enable {
environment.variables.XDG_DATA_DIRS = [ "${mimeAppsList}/share" ]; hardware.bluetooth.enable = mkDefault true;
hardware.pulseaudio.enable = mkDefault true;
programs.dconf.enable = true;
security.polkit.enable = true;
services.accounts-daemon.enable = true;
services.dleyna-renderer.enable = mkDefault true;
services.dleyna-server.enable = mkDefault true;
services.gnome3.at-spi2-core.enable = true;
services.gnome3.evolution-data-server.enable = true;
services.gnome3.gnome-keyring.enable = true;
services.gnome3.gnome-online-accounts.enable = mkDefault true;
services.gnome3.gnome-online-miners.enable = true;
services.gnome3.tracker-miners.enable = mkDefault true;
services.gnome3.tracker.enable = mkDefault true;
services.hardware.bolt.enable = mkDefault true;
services.packagekit.enable = mkDefault true;
services.udisks2.enable = true;
services.upower.enable = config.powerManagement.enable;
services.xserver.libinput.enable = mkDefault true; # for controlling touchpad settings via gnome control center
# Override GSettings schemas xdg.portal.enable = true;
environment.variables.NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-desktop-schemas}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas"; xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
# Let nautilus find extensions networking.networkmanager.enable = mkDefault true;
# TODO: Create nautilus-with-extensions package
environment.variables.NAUTILUS_EXTENSION_DIR = "${config.system.path}/lib/nautilus/extensions-3.0";
services.xserver.updateDbusEnvironment = true; # Use the correct gnome3 packageSet
networking.networkmanager.basePackages = {
environment.systemPackages = pkgs.gnome3.corePackages ++ cfg.sessionPath inherit (pkgs) networkmanager modemmanager wpa_supplicant crda;
++ (pkgs.gnome3.removePackagesByName pkgs.gnome3.optionalPackages config.environment.gnome3.excludePackages) ++ [
pkgs.xdg-user-dirs # Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/
];
# Use the correct gnome3 packageSet
networking.networkmanager.basePackages =
{ inherit (pkgs) networkmanager modemmanager wpa_supplicant crda;
inherit (pkgs.gnome3) networkmanager-openvpn networkmanager-vpnc inherit (pkgs.gnome3) networkmanager-openvpn networkmanager-vpnc
networkmanager-openconnect networkmanager-fortisslvpn networkmanager-openconnect networkmanager-fortisslvpn
networkmanager-iodine networkmanager-l2tp; }; networkmanager-iodine networkmanager-l2tp;
};
# Needed for themes and backgrounds services.xserver.updateDbusEnvironment = true;
environment.pathsToLink = [
"/share"
"/share/nautilus-python/extensions"
];
security.pam.services.gnome-screensaver = mkIf flashbackEnabled { # Needed for themes and backgrounds
enableGnomeKeyring = true; environment.pathsToLink = [
}; "/share" # TODO: https://github.com/NixOS/nixpkgs/issues/47173
}; ];
})
(mkIf serviceCfg.core-shell.enable {
services.colord.enable = mkDefault true;
services.gnome3.glib-networking.enable = true;
services.gnome3.gnome-remote-desktop.enable = mkDefault true;
services.gnome3.gnome-settings-daemon.enable = true;
services.gnome3.gnome-user-share.enable = mkDefault true;
services.gnome3.rygel.enable = mkDefault true;
services.gvfs.enable = true;
services.telepathy.enable = mkDefault true;
systemd.packages = [ pkgs.gnome3.vino ];
services.dbus.packages =
optional config.services.printing.enable pkgs.system-config-printer ++
optional flashbackEnabled pkgs.gnome3.gnome-screensaver;
services.geoclue2.enable = mkDefault true;
services.geoclue2.enableDemoAgent = false; # GNOME has its own geoclue agent
services.geoclue2.appConfig."gnome-datetime-panel" = {
isAllowed = true;
isSystem = true;
};
services.geoclue2.appConfig."gnome-color-panel" = {
isAllowed = true;
isSystem = true;
};
services.geoclue2.appConfig."org.gnome.Shell" = {
isAllowed = true;
isSystem = true;
};
fonts.fonts = with pkgs; [
cantarell-fonts
dejavu_fonts
source-code-pro # Default monospace font in 3.32
source-sans-pro
];
environment.systemPackages = with pkgs.gnome3; [
adwaita-icon-theme
gnome-backgrounds
gnome-bluetooth
gnome-control-center
gnome-getting-started-docs
gnome-shell
gnome-shell-extensions
gnome-themes-extra
gnome-user-docs
pkgs.glib # for gsettings
pkgs.gnome-menus
pkgs.gtk3.out # for gtk-launch
pkgs.hicolor-icon-theme
pkgs.shared-mime-info # for update-mime-database
pkgs.xdg-user-dirs # Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/
vino
];
security.pam.services.gnome-screensaver = mkIf flashbackEnabled {
enableGnomeKeyring = true;
};
})
(mkIf serviceCfg.core-utilities.enable {
environment.systemPackages = (with pkgs.gnome3; removePackagesByName [
baobab eog epiphany evince gucharmap nautilus totem yelp gnome-calculator
gnome-contacts gnome-font-viewer gnome-screenshot gnome-system-monitor simple-scan
gnome-terminal evolution file-roller gedit gnome-clocks gnome-music gnome-tweaks
pkgs.gnome-photos nautilus-sendto dconf-editor vinagre gnome-weather gnome-logs
gnome-maps gnome-characters gnome-calendar accerciser gnome-nettool gnome-packagekit
gnome-software gnome-power-manager gnome-todo pkgs.gnome-usage
] config.environment.gnome3.excludePackages);
# Enable default programs
programs.evince.enable = mkDefault true;
programs.file-roller.enable = mkDefault true;
programs.gnome-disks.enable = mkDefault true;
programs.gnome-documents.enable = mkDefault true;
programs.gnome-terminal.enable = mkDefault true;
services.gnome3.seahorse.enable = mkDefault true;
services.gnome3.sushi.enable = mkDefault true;
# Let nautilus find extensions
# TODO: Create nautilus-with-extensions package
environment.variables.NAUTILUS_EXTENSION_DIR = "${config.system.path}/lib/nautilus/extensions-3.0";
# Override default mimeapps for nautilus
environment.variables.XDG_DATA_DIRS = [ "${mimeAppsList}/share" ];
environment.pathsToLink = [
"/share/nautilus-python/extensions"
];
})
(mkIf serviceCfg.games.enable {
environment.systemPackages = (with pkgs.gnome3; removePackagesByName [
aisleriot atomix five-or-more four-in-a-row gnome-chess gnome-klotski
gnome-mahjongg gnome-mines gnome-nibbles gnome-robots gnome-sudoku
gnome-taquin gnome-tetravex hitori iagno lightsoff quadrapassel
swell-foop tali
] config.environment.gnome3.excludePackages);
})
];
} }

View File

@ -21,36 +21,6 @@ lib.makeScope pkgs.newScope (self: with self; {
maintainers = with pkgs.lib.maintainers; [ lethalman jtojnar hedning worldofpeace ]; maintainers = with pkgs.lib.maintainers; [ lethalman jtojnar hedning worldofpeace ];
corePackages = with gnome3; [
pkgs.desktop-file-utils
pkgs.shared-mime-info # for update-mime-database
pkgs.glib # for gsettings
pkgs.gtk3.out # for gtk-update-icon-cache
glib-networking gvfs dconf gnome-backgrounds gnome-control-center
pkgs.gnome-menus gnome-settings-daemon gnome-shell
gnome-themes-extra adwaita-icon-theme gnome-shell-extensions
pkgs.hicolor-icon-theme
];
optionalPackages = with gnome3; [ baobab eog epiphany evince
gucharmap nautilus totem vino yelp gnome-bluetooth
gnome-calculator gnome-contacts gnome-font-viewer gnome-screenshot
gnome-system-monitor simple-scan
gnome-terminal gnome-user-docs evolution file-roller gedit
gnome-clocks gnome-music gnome-tweaks pkgs.gnome-photos
nautilus-sendto dconf-editor vinagre gnome-weather gnome-logs
gnome-maps gnome-characters gnome-calendar accerciser gnome-nettool
gnome-getting-started-docs gnome-packagekit gnome-software
gnome-power-manager gnome-todo pkgs.gnome-usage
];
gamesPackages = with gnome3; [ swell-foop lightsoff iagno
tali quadrapassel gnome-sudoku atomix aisleriot five-or-more
four-in-a-row gnome-chess gnome-klotski gnome-mahjongg
gnome-mines gnome-nibbles gnome-robots gnome-tetravex
hitori gnome-taquin
];
libsoup = pkgs.libsoup.override { gnomeSupport = true; }; libsoup = pkgs.libsoup.override { gnomeSupport = true; };
libchamplain = pkgs.libchamplain.override { libsoup = libsoup; }; libchamplain = pkgs.libchamplain.override { libsoup = libsoup; };
gnome3 = self // { recurseForDerivations = false; }; gnome3 = self // { recurseForDerivations = false; };