summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2022-06-29 14:24:43 +0200
committerGitHub <noreply@github.com>2022-06-29 14:24:43 +0200
commitce28c9914008fdff58b4f17e0f2b341a8972019f (patch)
treebfd12ab59fbdac0b84f6596ffc61bf46d72fbedd /nixos/modules/config
parent50a3c30f43d362ef123a533aa45e98fc85dd9832 (diff)
parentebde08adf37932ff59c27b5935840aa733965bdb (diff)
downloadnixpkgs-ce28c9914008fdff58b4f17e0f2b341a8972019f.tar
nixpkgs-ce28c9914008fdff58b4f17e0f2b341a8972019f.tar.gz
nixpkgs-ce28c9914008fdff58b4f17e0f2b341a8972019f.tar.bz2
nixpkgs-ce28c9914008fdff58b4f17e0f2b341a8972019f.tar.lz
nixpkgs-ce28c9914008fdff58b4f17e0f2b341a8972019f.tar.xz
nixpkgs-ce28c9914008fdff58b4f17e0f2b341a8972019f.tar.zst
nixpkgs-ce28c9914008fdff58b4f17e0f2b341a8972019f.zip
Merge pull request #179204 from jtojnar/no-gtk-xdg-use-portal
nixos/xdg.portal: deprecate gtkUsePortal option
Diffstat (limited to 'nixos/modules/config')
-rw-r--r--nixos/modules/config/xdg/portal.nix27
1 files changed, 24 insertions, 3 deletions
diff --git a/nixos/modules/config/xdg/portal.nix b/nixos/modules/config/xdg/portal.nix
index 088f2af59e2..1e6ddd7c4a2 100644
--- a/nixos/modules/config/xdg/portal.nix
+++ b/nixos/modules/config/xdg/portal.nix
@@ -1,10 +1,30 @@
 { config, pkgs, lib, ... }:
 
-with lib;
+let
+  inherit (lib)
+    mkEnableOption
+    mkIf
+    mkOption
+    mkRenamedOptionModule
+    teams
+    types;
+in
 
 {
   imports = [
     (mkRenamedOptionModule [ "services" "flatpak" "extraPortals" ] [ "xdg" "portal" "extraPortals" ])
+
+    ({ config, lib, options, ... }:
+      let
+        from = [ "xdg" "portal" "gtkUsePortal" ];
+        fromOpt = lib.getAttrFromPath from options;
+      in
+      {
+        warnings = lib.mkIf config.xdg.portal.gtkUsePortal [
+          "The option `${lib.showOption from}' defined in ${lib.showFiles fromOpt.files} has been deprecated. Setting the variable globally with `environment.sessionVariables' NixOS option can have unforseen side-effects."
+        ];
+      }
+    )
   ];
 
   meta = {
@@ -32,11 +52,12 @@ with lib;
 
     gtkUsePortal = mkOption {
       type = types.bool;
+      visible = false;
       default = false;
       description = ''
         Sets environment variable <literal>GTK_USE_PORTAL</literal> to <literal>1</literal>.
-        This is needed for packages ran outside Flatpak to respect and use XDG Desktop Portals.
-        For example, you'd need to set this for non-flatpak Firefox to use native filechoosers.
+        This will force GTK-based programs ran outside Flatpak to respect and use XDG Desktop Portals
+        for features like file chooser but it is an unsupported hack that can easily break things.
         Defaults to <literal>false</literal> to respect its opt-in nature.
       '';
     };