From b449cb77b19be059f2a3cf9e7e26d3f68cea56a8 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 14 May 2021 21:06:54 +0200 Subject: [PATCH] firefox: deprecate 'enableGnomeExtensions' Fixes #1990. --- modules/programs/firefox.nix | 18 ++++++++++ tests/modules/programs/firefox/default.nix | 1 + .../firefox/deprecated-native-messenger.nix | 33 +++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 tests/modules/programs/firefox/deprecated-native-messenger.nix diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index 53e1168f..72f6b983 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -86,6 +86,17 @@ in then pkgs.firefox else pkgs.firefox-unwrapped; defaultText = literalExample "pkgs.firefox"; + example = literalExample '' + pkgs.firefox.override { + # See nixpkgs' firefox/wrapper.nix to check which options you can use + cfg = { + # Gnome shell native connector + enableGnomeExtensions = true; + # Tridactyl native connector + enableTridactylNative = true; + }; + } + ''; description = '' The Firefox package to use. If state version ≥ 19.09 then this should be a wrapped Firefox package. For earlier state @@ -264,6 +275,13 @@ in ) ]; + warnings = optional (cfg.enableGnomeExtensions or false) '' + Using 'programs.firefox.enableGnomeExtensions' has been deprecated and + will be removed in the future. Please change to overriding the package + configuration using 'programs.firefox.package' instead. You can refer to + its example for how to do this. + ''; + home.packages = let # The configuration expected by the Firefox wrapper. diff --git a/tests/modules/programs/firefox/default.nix b/tests/modules/programs/firefox/default.nix index 6612a9ac..cc8e2fc4 100644 --- a/tests/modules/programs/firefox/default.nix +++ b/tests/modules/programs/firefox/default.nix @@ -1,4 +1,5 @@ { firefox-profile-settings = ./profile-settings.nix; firefox-state-version-19_09 = ./state-version-19_09.nix; + firefox-deprecated-native-messenger = ./deprecated-native-messenger.nix; } diff --git a/tests/modules/programs/firefox/deprecated-native-messenger.nix b/tests/modules/programs/firefox/deprecated-native-messenger.nix new file mode 100644 index 00000000..3bcdbe67 --- /dev/null +++ b/tests/modules/programs/firefox/deprecated-native-messenger.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs.firefox = { + enable = true; + enableGnomeExtensions = true; + }; + + nixpkgs.overlays = [ + (self: super: { + firefox-unwrapped = pkgs.runCommand "firefox-0" { + meta.description = "I pretend to be Firefox"; + preferLocalBuild = true; + allowSubstitutes = false; + } '' + mkdir -p "$out/bin" + touch "$out/bin/firefox" + chmod 755 "$out/bin/firefox" + ''; + }) + ]; + + test.asserts.warnings.expected = ['' + Using 'programs.firefox.enableGnomeExtensions' has been deprecated and + will be removed in the future. Please change to overriding the package + configuration using 'programs.firefox.package' instead. You can refer to + its example for how to do this. + '']; + }; +}