summary refs log tree commit diff
path: root/nixos/modules/config/xdg
diff options
context:
space:
mode:
authorPasquale <p3dimaria@hotmail.it>2019-07-10 16:01:25 +0200
committerworldofpeace <worldofpeace@protonmail.ch>2019-07-18 19:59:07 -0400
commit90b1197301eb714e64a508c3be2dd073b24caed3 (patch)
tree82ff3e1cdf9ec022b0ce46d0132840ec35cf9504 /nixos/modules/config/xdg
parent2ce67ce18330cbd7c6239c993c6c8a3e103d412e (diff)
downloadnixpkgs-90b1197301eb714e64a508c3be2dd073b24caed3.tar
nixpkgs-90b1197301eb714e64a508c3be2dd073b24caed3.tar.gz
nixpkgs-90b1197301eb714e64a508c3be2dd073b24caed3.tar.bz2
nixpkgs-90b1197301eb714e64a508c3be2dd073b24caed3.tar.lz
nixpkgs-90b1197301eb714e64a508c3be2dd073b24caed3.tar.xz
nixpkgs-90b1197301eb714e64a508c3be2dd073b24caed3.tar.zst
nixpkgs-90b1197301eb714e64a508c3be2dd073b24caed3.zip
nixos/xdg: add portal option
This factors the configuration out of the flatpak module.
Diffstat (limited to 'nixos/modules/config/xdg')
-rw-r--r--nixos/modules/config/xdg/portal.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/nixos/modules/config/xdg/portal.nix b/nixos/modules/config/xdg/portal.nix
new file mode 100644
index 00000000000..76ca435d434
--- /dev/null
+++ b/nixos/modules/config/xdg/portal.nix
@@ -0,0 +1,38 @@
+{ config, pkgs ,lib ,... }:
+with lib;
+{
+  options.xdg.portal = {
+    enable =
+      mkEnableOption "<link xlink:href='https://github.com/flatpak/xdg-desktop-portal'>xdg desktop integration</link>"//{
+        default = true;
+      };
+
+    extraPortals = mkOption {
+      type = types.listOf types.package;
+      default = [];
+      description = ''
+        List of additional portals to add to path. Portals allow interaction
+        with system, like choosing files or taking screenshots. At minimum,
+        a desktop portal implementation should be listed. GNOME and KDE already
+        adds <package>xdg-desktop-portal-gtk</package>; and
+        <package>xdg-desktop-portal-kde</package> respectively. On other desktop
+        environments you probably want to add them yourself.
+      '';
+    };
+  };
+
+  config =
+    let
+      cfg = config.xdg.portal;
+      packages = [ pkgs.xdg-desktop-portal ] ++ cfg.extraPortals;
+
+    in mkIf cfg.enable {
+
+      services.dbus.packages  = packages;
+      systemd.packages = packages;
+      environment.variables = {
+        GTK_USE_PORTAL = "1";
+        XDG_DESKTOP_PORTAL_PATH = map (p: "${p}/share/xdg-desktop-portal/portals") cfg.extraPortals;
+      };
+    };
+}