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 1 { config, pkgs, lib, ... }: 2 2 3 - with lib; 3 + let 4 + inherit (lib) 5 + mkEnableOption 6 + mkIf 7 + mkOption 8 + mkRenamedOptionModule 9 + teams 10 + types; 11 + in 4 12 5 13 { 6 14 imports = [ 7 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 + ) 8 28 ]; 9 29 10 30 meta = { ··· 32 52 33 53 gtkUsePortal = mkOption { 34 54 type = types.bool; 55 + visible = false; 35 56 default = false; 36 57 description = '' 37 58 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. 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. 40 61 Defaults to <literal>false</literal> to respect its opt-in nature. 41 62 ''; 42 63 };