nixos/desktops: deduplicate removePackagesByName
GNOME, MATE and LxQt all use removePackagesByName. Let’s move it to a single place, rename the attributes to meaningful name and add docs.
This commit is contained in:
parent
626233eee6
commit
bedc81fcb6
4 changed files with 19 additions and 28 deletions
|
@ -5,14 +5,6 @@ with lib;
|
|||
let
|
||||
cfg = config.services.xserver.desktopManager.gnome3;
|
||||
|
||||
# Remove packages of ys from xs, based on their names
|
||||
removePackagesByName = xs: ys:
|
||||
let
|
||||
pkgName = drv: (builtins.parseDrvName drv.name).name;
|
||||
ysNames = map pkgName ys;
|
||||
in
|
||||
filter (x: !(builtins.elem (pkgName x) ysNames)) xs;
|
||||
|
||||
# Prioritize nautilus by default when opening directories
|
||||
mimeAppsList = pkgs.writeTextFile {
|
||||
name = "gnome-mimeapps";
|
||||
|
@ -167,7 +159,7 @@ in {
|
|||
"${pkgs.gnome3.glib-networking.out}/lib/gio/modules"
|
||||
"${pkgs.gnome3.gvfs}/lib/gio/modules" ];
|
||||
environment.systemPackages = pkgs.gnome3.corePackages ++ cfg.sessionPath
|
||||
++ (removePackagesByName pkgs.gnome3.optionalPackages config.environment.gnome3.excludePackages) ++ [
|
||||
++ (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/
|
||||
];
|
||||
|
||||
|
|
|
@ -3,15 +3,6 @@
|
|||
with lib;
|
||||
|
||||
let
|
||||
|
||||
# Remove packages of ys from xs, based on their names
|
||||
removePackagesByName = xs: ys:
|
||||
let
|
||||
pkgName = drv: (builtins.parseDrvName drv.name).name;
|
||||
ysNames = map pkgName ys;
|
||||
in
|
||||
filter (x: !(builtins.elem (pkgName x) ysNames)) xs;
|
||||
|
||||
xcfg = config.services.xserver;
|
||||
cfg = xcfg.desktopManager.lxqt;
|
||||
|
||||
|
@ -60,7 +51,7 @@ in
|
|||
environment.systemPackages =
|
||||
pkgs.lxqt.preRequisitePackages ++
|
||||
pkgs.lxqt.corePackages ++
|
||||
(removePackagesByName
|
||||
(pkgs.gnome3.removePackagesByName
|
||||
pkgs.lxqt.optionalPackages
|
||||
config.environment.lxqt.excludePackages);
|
||||
|
||||
|
|
|
@ -4,14 +4,6 @@ with lib;
|
|||
|
||||
let
|
||||
|
||||
# Remove packages of ys from xs, based on their names
|
||||
removePackagesByName = xs: ys:
|
||||
let
|
||||
pkgName = drv: (builtins.parseDrvName drv.name).name;
|
||||
ysNames = map pkgName ys;
|
||||
in
|
||||
filter (x: !(builtins.elem (pkgName x) ysNames)) xs;
|
||||
|
||||
addToXDGDirs = 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}
|
||||
|
@ -96,7 +88,7 @@ in
|
|||
|
||||
environment.systemPackages =
|
||||
pkgs.mate.basePackages ++
|
||||
(removePackagesByName
|
||||
(pkgs.gnome3.removePackagesByName
|
||||
pkgs.mate.extraPackages
|
||||
config.environment.mate.excludePackages);
|
||||
|
||||
|
|
|
@ -3,6 +3,22 @@
|
|||
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
|
||||
pkgName = drv: (builtins.parseDrvName drv.name).name;
|
||||
namesToRemove = map pkgName packagesToRemove;
|
||||
in
|
||||
filter (x: !(builtins.elem (pkgName x) namesToRemove)) packages;
|
||||
|
||||
maintainers = with pkgs.lib.maintainers; [ lethalman jtojnar hedning ];
|
||||
|
||||
corePackages = with gnome3; [
|
||||
|
|
Loading…
Reference in a new issue