about summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorLuna Nova <git@lunnova.dev>2022-10-21 13:19:24 -0700
committerBjørn Forsman <bjorn.forsman@gmail.com>2022-11-12 18:45:32 +0100
commit7a908bec558f9b105424d9a25769c7dabd66bed4 (patch)
treeb360fdc6da79f829010af28fc5150d784b8eedf1 /nixos/modules/config
parenteaab93d6389e80a72f4ba2281b72de44c4bf4496 (diff)
nixos/xdg/portal: add option `xdgOpenUsePortal` which sets `NIXOS_XDG_OPEN_USE_PORTAL`
Diffstat (limited to 'nixos/modules/config')
-rw-r--r--nixos/modules/config/xdg/portal.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/nixos/modules/config/xdg/portal.nix b/nixos/modules/config/xdg/portal.nix
index e28ff74e5d80a..ab6cffe499aa8 100644
--- a/nixos/modules/config/xdg/portal.nix
+++ b/nixos/modules/config/xdg/portal.nix
@@ -61,6 +61,17 @@ in
         Defaults to `false` to respect its opt-in nature.
       '';
     };
+
+    xdgOpenUsePortal = mkOption {
+      type = types.bool;
+      default = false;
+      description = lib.mdDoc ''
+        Sets environment variable `NIXOS_XDG_OPEN_USE_PORTAL` to `1`
+        This will make `xdg-open` use the portal to open programs, which resolves bugs involving
+        programs opening inside FHS envs or with unexpected env vars set from wrappers.
+        See [#160923](https://github.com/NixOS/nixpkgs/issues/160923) for more info.
+      '';
+    };
   };
 
   config =
@@ -95,6 +106,7 @@ in
 
         sessionVariables = {
           GTK_USE_PORTAL = mkIf cfg.gtkUsePortal "1";
+          NIXOS_XDG_OPEN_USE_PORTAL = mkIf cfg.xdgOpenUsePortal "1";
           XDG_DESKTOP_PORTAL_DIR = "${joinedPortals}/share/xdg-desktop-portal/portals";
         };
       };