Why does enabling xdg.portal install so many packages?

I don’t use a desktop environment, just sway, but I figured I’d try enabling xdg.portal to see if that helped with properly opening URLs in Firefox.

  xdg.portal = {
    enable = true;
    wlr.enable = true;

But that one change installed a lot of packages, such as networkmanager, which I don’t use:

<<< /nix/var/nix/profiles/system-63-link
>>> /nix/var/nix/profiles/system-64-link
Added packages:
[A.]  #01  ethtool                              6.1
[A.]  #02  geoclue                              2.7.0
[A.]  #03  glib-networking                      2.76.0
[A.]  #04  gobject-introspection-wrapped        1.76.1
[A.]  #05  grim                                 1.4.0
[A.]  #06  inih                                 56
[A.]  #07  libmbim                              1.28.4
[A.]  #08  libndp                               1.8
[A.]  #09  libproxy                             0.4.18
[A.]  #10  libqmi                               1.32.2
[A.]  #11  libqrtr-glib                         1.2.2
[A.]  #12  mobile-broadband-provider-info       20230416
[A.]  #13  modemmanager                         1.20.6
[A.]  #14  networkmanager                       1.42.6
[A.]  #15  newt                                 0.52.23
[A.]  #16  nftables                             1.0.7
[A.]  #17  openconnect                          9.01
[A.]  #18  ppp                                  2.5.0
[A.]  #19  slang                                2.3.3
[A.]  #20  slurp                                1.4.0
[A.]  #21  stoken                               0.92
[A.]  #22  unit-xdg-desktop-portal-wlr.service  <none>
[A.]  #23  vpnc-scripts-unstable                2023-01-03
[A.]  #24  xdg-desktop-portal                   1.16.0
[A.]  #25  xdg-desktop-portal-wlr               0.7.0
[A.]  #26  xdg-desktop-portal-wlr.ini           <none>
[A.]  #27  xdg-portals                          <none>

Is this normal? Why do portals need all this installed?

Yes, because they depend on libraries which depend on other libraries.

networkmanager also has a library which libproxy depends on. networkmanager is then a dependency of glib-networking which is used by xdg-desktop-portal.

You can check this with nix-tree.

1 Like

Didn’t know about nix-tree, thanks for that!

It’s unfortunate that there are so many dependencies for that one package. Sounds like a candidate for breaking up further into options.

You can give that a try maybe it is easy, maybe it is not. We usually prefer having one or two extra dependencies rather than building multiple variants of packages unless the difference is very big in dependencies.

Lot of those are VPN things depended on by NetworkManager for a specific VPN type (e.g. IIRC, openconnect → stoken → gtk2). Ideally, they would be moved to the appropriate NM plug-ins but it requires upstream changes.

1 Like

libnm also just seems weirdly designed to me, they shove together in one library a thin dbus API client (most likely what libproxy needs) but also a ton of unrelated/internal nm backend stuff that likely can’t be used by client apps anyway. Might still be able to reduce its closure side by moving it to a separate output from the main nm binary.

Luckily libproxy 0.5.0 just released 5 days ago, it’s apparently a complete rewrite (exciting…), and it doesn’t depend on libnm anymore. So far it looks like only Gentoo has it packaged according to repology. But it also looks like it has no nixpkgs maintainer…


thanks i am useing that for flatpak

       Failed assertions:
       - To use Flatpak you must enable XDG Desktop Portals with xdg.portal.enable.