nix-files/hosts/common/programs/xdg-desktop-portal.nix

27 lines
858 B
Nix

{ config, lib, ... }:
let
cfg = config.sane.programs.xdg-desktop-portal;
in
{
sane.programs.xdg-desktop-portal = {
services.xdg-desktop-portal = {
description = "Portal service";
wantedBy = [ "graphical-session.target" ];
serviceConfig = {
ExecStart="${cfg.package}/libexec/xdg-desktop-portal";
Type = "dbus";
BusName = "org.freedesktop.portal.Desktop";
};
# xdg-desktop-portal needs to know where to find xdg-desktop-portal-gtk, etc, for some reason (???).
# otherwise, it won't expose stuff like the OpenURI endpoint, even if a suitable AppChooser is available on dbus.
environment.XDG_DESKTOP_PORTAL_DIR = "/etc/profiles/per-user/%u/share/xdg-desktop-portal/portals";
};
};
environment.pathsToLink = lib.mkIf cfg.enabled [
"/share/xdg-desktop-portal/portals"
];
}