Hello everyone,
Nix noob here, I’m running into issues getting xdg-desktop-portal working via Home Manager on Ubuntu (I’m locked to Ubuntu due to work computer). I’m using Home Manager to set up Hyprland through nixGL, and everything else is working well so far, except screen sharing via xdg-desktop-portal. I’d greatly appreciate any guidance on how to properly configure this.
1. Environment & Goal
-
OS: Ubuntu (version ≈ 24.04 LTS)
-
Window manager: Hyprland via home-manager and nixGL
-
Goal: Enable screen sharing (and other portal functionality) by installing and configuring
xdg-desktop-portal-hyprland
(or an appropriate portal backend) entirely through my Home Manager setup. -
Gist that I initially used to set up hyprland on ubuntu: AntonFriberg gist
2. Background & References
I believe it’s possible because of:
- A discussion on Reddit: “Is it possible to configure xdgportalwlr in Nix?”
- Home Manager PR that adds portal support: nix-community/home-manager#4707
I’d like to follow the “Home Manager way” instead of manually hacking scripts, so that all my config remains declarative and reproducible.
3. What I Have Tried
-
Added
xdg.portal.enable = true;
and includedxdg-desktop-portal-hyprland
/xdg-desktop-portal-gtk
inextraPortals
.
Myxdg.portal
block currently looks like this:xdg.portal = { enable = true; extraPortals = with pkgs; [ xdg-desktop-portal-hyprland # (config.lib.nixGL.wrap xdg-desktop-portal-hyprland) # xdg-desktop-portal-wlr xdg-desktop-portal-gtk ]; configPackages = [ /* pkgs.hyprland */ ]; config = { hyprland.default = [ "hyprland" "gtk" ]; }; };
However, I get the following collision error:
error: collision between `/nix/store/kryxh2frhdr8kv97ximfnn3gl9rw040w-xdg-desktop-portal-hyprland-1.3.9/bin/hyprland-share-picker` and `/nix/store/kzc3zkpg19s9rz681sa90ajkc08c3cqn-xdg-desktop-portal-hyprland-1.3.9/bin/hyprland-share-picker`
(I suspect this is caused by the nixGL wrapper wrapping Hyprland itself?)
If i do not specify the package i do not get it to work either, not even using wlr i get it to work. So i must be doing something wrong, but i can not figure it out. -
Tried alternative portal backends
I’ve experimented with onlyxdg-desktop-portal-wlr
or onlyxdg-desktop-portal-gtk
, but neither seems to provide the proper Hyprland integration for screen sharing. In particular, Hyprland requires the specializedxdg-desktop-portal-hyprland
binary to handle the share picker. -
Checked the Hyprland portal repository’s caution
Thehyprwm/xdg-desktop-portal-hyprland
README mentions a caution about not using the portal directly without wrapping or additional environment variables. I’m not sure how to translate that advice into a Home Manager expression.
4. Links to My Configs
-
Home Manager repo:
https://github.com/iamDrakkir/home-manager -
Dotfiles & Hyprland config:
https://github.com/iamDrakkir/dotfiles
5. Questions & Request for Help
-
Recommended Expression:
What is the correct way to declare and enablexdg-desktop-portal-hyprland
entirely via Home Manager? Is there an example snippet that I can adapt? -
Resolving the Collision:
How do I avoid the “collision” between two identicalhyprland-share-picker
binaries in the store? Should I:- Wrap the portal package with
nixGL.wrap
? - Mask one of the binaries using
config.xdg.porters.blacklist
or a similar Home Manager option? - Use a different attribute name or override?
- Wrap the portal package with
-
Fallback / Alternative:
Ifxdg-desktop-portal-hyprland
is not feasible via Home Manager, is there a reliable way to configure Hyprland’s portal manually in conjunction with Home Manager—without losing the reproducibility and “single source of truth” benefits of Home Manager?
I’m grateful for any pointers, example configs, or patch suggestions. Thank you in advance!
Thanks again,
Drakkir