Merge pull request #179204 from jtojnar/no-gtk-xdg-use-portal

nixos/xdg.portal: deprecate gtkUsePortal option

authored by Jan Tojnar and committed by GitHub ce28c991 50a3c30f

+24 -3
+24 -3
nixos/modules/config/xdg/portal.nix
··· 1 { config, pkgs, lib, ... }: 2 3 - with lib; 4 5 { 6 imports = [ 7 (mkRenamedOptionModule [ "services" "flatpak" "extraPortals" ] [ "xdg" "portal" "extraPortals" ]) 8 ]; 9 10 meta = { ··· 32 33 gtkUsePortal = mkOption { 34 type = types.bool; 35 default = false; 36 description = '' 37 Sets environment variable <literal>GTK_USE_PORTAL</literal> to <literal>1</literal>. 38 - This is needed for packages ran outside Flatpak to respect and use XDG Desktop Portals. 39 - For example, you'd need to set this for non-flatpak Firefox to use native filechoosers. 40 Defaults to <literal>false</literal> to respect its opt-in nature. 41 ''; 42 };
··· 1 { config, pkgs, lib, ... }: 2 3 + let 4 + inherit (lib) 5 + mkEnableOption 6 + mkIf 7 + mkOption 8 + mkRenamedOptionModule 9 + teams 10 + types; 11 + in 12 13 { 14 imports = [ 15 (mkRenamedOptionModule [ "services" "flatpak" "extraPortals" ] [ "xdg" "portal" "extraPortals" ]) 16 + 17 + ({ config, lib, options, ... }: 18 + let 19 + from = [ "xdg" "portal" "gtkUsePortal" ]; 20 + fromOpt = lib.getAttrFromPath from options; 21 + in 22 + { 23 + warnings = lib.mkIf config.xdg.portal.gtkUsePortal [ 24 + "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." 25 + ]; 26 + } 27 + ) 28 ]; 29 30 meta = { ··· 52 53 gtkUsePortal = mkOption { 54 type = types.bool; 55 + visible = false; 56 default = false; 57 description = '' 58 Sets environment variable <literal>GTK_USE_PORTAL</literal> to <literal>1</literal>. 59 + This will force GTK-based programs ran outside Flatpak to respect and use XDG Desktop Portals 60 + for features like file chooser but it is an unsupported hack that can easily break things. 61 Defaults to <literal>false</literal> to respect its opt-in nature. 62 ''; 63 };