zoom-us: allow to select xdg-desktop-portal packages

To reduce the closure size of the zoom-us package,
this commit replaces the `xdgDesktopPortalSupport`
option with several new options that permit to (de-)select
several XDG desktop portal packages to be used by `zoom-us`.
Furthermore, two new options permit to inject further packages
(e.g. individual XDG desktop portal packages) into the virtual
filesystem that will be prepared by bubblewrap for zoom-us:

* `targetPkgs` is a *function* that maps the `pkgs`
  packages attrset to a list of packages.
* `targetPkgsFixed` is a simple list of packages.

`targetPkgs` should be preferred before
`targetPkgsFixed` if possible, as the `buildFHSEnv`
mechanism expects a function as explained above:
It needs to extract a list of dependency
packages for a `pkgs` package attrset.
Package injection likely also works if `targetPkgsFixed`
is used, but that creates a liability
in that changes of the `buildFHSEnv` implementation might
(at least more likely) break zoom-us in unexpected ways.

Note: This now *disables* all
XDG desktop portal packages by default.

Co-authored-by: Philip Taron <philip.taron@gmail.com>
This commit is contained in:
Yarny0 2025-04-30 15:43:02 +02:00
parent 2795c506fe
commit b215903865

View file

@ -5,10 +5,51 @@
makeWrapper,
xar,
cpio,
pulseaudioSupport ? true,
xdgDesktopPortalSupport ? true,
callPackage,
buildFHSEnv,
# Support pulseaudio by default
pulseaudioSupport ? true,
# Whether to support XDG portals at all
xdgDesktopPortalSupport ? (
plasma6XdgDesktopPortalSupport
|| plasma5XdgDesktopPortalSupport
|| lxqtXdgDesktopPortalSupport
|| gnomeXdgDesktopPortalSupport
|| hyprlandXdgDesktopPortalSupport
|| wlrXdgDesktopPortalSupport
|| xappXdgDesktopPortalSupport
),
# This is Plasma 6 (KDE) XDG portal support
plasma6XdgDesktopPortalSupport ? false,
# This is Plasma 5 (KDE) XDG portal support
plasma5XdgDesktopPortalSupport ? false,
# This is LXQT XDG portal support
lxqtXdgDesktopPortalSupport ? false,
# This is GNOME XDG portal support
gnomeXdgDesktopPortalSupport ? false,
# This is Hyprland XDG portal support
hyprlandXdgDesktopPortalSupport ? false,
# This is `wlroots` XDG portal support
wlrXdgDesktopPortalSupport ? false,
# This is Xapp XDG portal support, used for GTK and various Cinnamon/MATE/Xfce4 infrastructure.
xappXdgDesktopPortalSupport ? false,
# This function can be overridden to add in extra packages
targetPkgs ? pkgs: [ ],
# This list can be overridden to add in extra packages
# that are independent of the underlying package attrset
targetPkgsFixed ? [ ],
}:
let
@ -179,17 +220,19 @@ let
pkgs.libpulseaudio
pkgs.pulseaudio
]
++ lib.optionals xdgDesktopPortalSupport [
pkgs.kdePackages.xdg-desktop-portal-kde
pkgs.lxqt.xdg-desktop-portal-lxqt
pkgs.plasma5Packages.xdg-desktop-portal-kde
pkgs.xdg-desktop-portal
++ lib.optional xdgDesktopPortalSupport pkgs.xdg-desktop-portal
++ lib.optional plasma6XdgDesktopPortalSupport pkgs.kdePackages.xdg-desktop-portal-kde
++ lib.optional plasma5XdgDesktopPortalSupport pkgs.plasma5Packages.xdg-desktop-portal-kde
++ lib.optional lxqtXdgDesktopPortalSupport pkgs.lxqt.xdg-desktop-portal-lxqt
++ lib.optionals gnomeXdgDesktopPortalSupport [
pkgs.xdg-desktop-portal-gnome
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-hyprland
pkgs.xdg-desktop-portal-wlr
pkgs.xdg-desktop-portal-xapp
];
]
++ lib.optional hyprlandXdgDesktopPortalSupport pkgs.xdg-desktop-portal-hyprland
++ lib.optional wlrXdgDesktopPortalSupport pkgs.xdg-desktop-portal-wlr
++ lib.optional xappXdgDesktopPortalSupport pkgs.xdg-desktop-portal-xapp
++ targetPkgs pkgs
++ targetPkgsFixed;
# We add the `unpacked` zoom archive to the FHS env
# and also bind-mount its `/opt` directory.