Merge pull request #168194 from SuperSandro2000/xserver-excludePackages

Xserver exclude packages
This commit is contained in:
Sandro 2022-04-13 11:37:32 +02:00 committed by GitHub
commit a39694b41f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 38 additions and 30 deletions

View File

@ -194,6 +194,22 @@ rec {
(( ! $inherit_errexit_enabled )) && shopt -u inherit_errexit
'';
/* Remove packages of packagesToRemove from packages, based on their names.
Relies on package names and has quadratic complexity so use with caution!
Type:
removePackagesByName :: [package] -> [package] -> [package]
Example:
removePackagesByName [ nautilus file-roller ] [ file-roller totem ]
=> [ nautilus ]
*/
removePackagesByName = packages: packagesToRemove:
let
namesToRemove = map lib.getName packagesToRemove;
in
lib.filter (x: !(builtins.elem (lib.getName x) namesToRemove)) packages;
systemdUtils = {
lib = import ./systemd-lib.nix { inherit lib config pkgs; };
unitOptions = import ./systemd-unit-options.nix { inherit lib systemdUtils; };

View File

@ -196,7 +196,7 @@ in
programs.evince.enable = mkDefault true;
programs.file-roller.enable = mkDefault true;
environment.systemPackages = (with pkgs // pkgs.gnome // pkgs.cinnamon; pkgs.gnome.removePackagesByName [
environment.systemPackages = with pkgs // pkgs.gnome // pkgs.cinnamon; lib.utils.removePackagesByName [
# cinnamon team apps
bulky
blueberry
@ -212,7 +212,7 @@ in
# external apps shipped with linux-mint
hexchat
gnome-calculator
] config.environment.cinnamon.excludePackages);
] config.environment.cinnamon.excludePackages;
})
];
}

View File

@ -455,7 +455,7 @@ in
(mkIf serviceCfg.core-utilities.enable {
environment.systemPackages =
with pkgs.gnome;
removePackagesByName
lib.utils.removePackagesByName
([
baobab
cheese
@ -515,7 +515,7 @@ in
})
(mkIf serviceCfg.games.enable {
environment.systemPackages = (with pkgs.gnome; removePackagesByName [
environment.systemPackages = with pkgs.gnome; lib.utils.removePackagesByName [
aisleriot
atomix
five-or-more
@ -536,12 +536,12 @@ in
quadrapassel
swell-foop
tali
] config.environment.gnome.excludePackages);
] config.environment.gnome.excludePackages;
})
# Adapt from https://gitlab.gnome.org/GNOME/gnome-build-meta/-/blob/3.38.0/elements/core/meta-gnome-core-developer-tools.bst
(mkIf serviceCfg.core-developer-tools.enable {
environment.systemPackages = (with pkgs.gnome; removePackagesByName [
environment.systemPackages = with pkgs.gnome; lib.utils.removePackagesByName [
dconf-editor
devhelp
pkgs.gnome-builder
@ -550,7 +550,7 @@ in
# in default configurations.
# https://github.com/NixOS/nixpkgs/issues/60908
/* gnome-boxes */
] config.environment.gnome.excludePackages);
] config.environment.gnome.excludePackages;
services.sysprof.enable = notExcluded pkgs.sysprof;
})

View File

@ -51,7 +51,7 @@ in
environment.systemPackages =
pkgs.lxqt.preRequisitePackages ++
pkgs.lxqt.corePackages ++
(pkgs.gnome.removePackagesByName
(lib.utils.removePackagesByName
pkgs.lxqt.optionalPackages
config.environment.lxqt.excludePackages);

View File

@ -47,7 +47,7 @@ in
# Debugging
environment.sessionVariables.MATE_SESSION_DEBUG = mkIf cfg.debug "1";
environment.systemPackages = pkgs.gnome.removePackagesByName
environment.systemPackages = lib.utils.removePackagesByName
(pkgs.mate.basePackages ++
pkgs.mate.extraPackages ++
[

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, utils, pkgs, ... }:
with lib;
@ -214,7 +214,7 @@ in
elementary-settings-daemon
pantheon-agent-geoclue2
pantheon-agent-polkit
]) ++ (gnome.removePackagesByName [
]) ++ (utils.removePackagesByName [
gnome.gnome-font-viewer
gnome.gnome-settings-daemon338
] config.environment.pantheon.excludePackages);
@ -272,7 +272,7 @@ in
})
(mkIf serviceCfg.apps.enable {
environment.systemPackages = with pkgs.pantheon; pkgs.gnome.removePackagesByName ([
environment.systemPackages = with pkgs.pantheon; utils.removePackagesByName ([
elementary-calculator
elementary-calendar
elementary-camera

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, utils, pkgs, ... }:
with lib;
@ -181,6 +181,13 @@ in
'';
};
excludePackages = mkOption {
default = [];
example = literalExpression "[ pkgs.xterm ]";
type = types.listOf types.package;
description = "Which X11 packages to exclude from the default environment";
};
exportConfiguration = mkOption {
type = types.bool;
default = false;
@ -655,7 +662,7 @@ in
${cfgPath}.source = xorg.xf86inputevdev.out + "/share" + cfgPath;
});
environment.systemPackages =
environment.systemPackages = utils.removePackagesByName
[ xorg.xorgserver.out
xorg.xrandr
xorg.xrdb
@ -671,7 +678,7 @@ in
pkgs.xdg-utils
xorg.xf86inputevdev.out # get evdev.4 man page
pkgs.nixos-icons # needed for gnome and pantheon about dialog, nixos-manual and maybe more
]
] config.services.xserver.excludePackages
++ optional (elem "virtualbox" cfg.videoDrivers) xorg.xrefresh;
environment.pathsToLink = [ "/share/X11" ];

View File

@ -3,21 +3,6 @@
lib.makeScope pkgs.newScope (self: with self; {
updateScript = callPackage ./update.nix { };
/* Remove packages of packagesToRemove from packages, based on their names
Type:
removePackagesByName :: [package] -> [package] -> [package]
Example:
removePackagesByName [ nautilus file-roller ] [ file-roller totem ]
=> [ nautilus ]
*/
removePackagesByName = packages: packagesToRemove:
let
namesToRemove = map lib.getName packagesToRemove;
in
lib.filter (x: !(builtins.elem (lib.getName x) namesToRemove)) packages;
libsoup = pkgs.libsoup.override { gnomeSupport = true; };
libchamplain = pkgs.libchamplain.override { libsoup = libsoup; };