aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/programs/firefox.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/modules/programs/firefox.nix')
-rw-r--r--home-manager/modules/programs/firefox.nix112
1 files changed, 63 insertions, 49 deletions
diff --git a/home-manager/modules/programs/firefox.nix b/home-manager/modules/programs/firefox.nix
index 17c64752d66..d5003f59edc 100644
--- a/home-manager/modules/programs/firefox.nix
+++ b/home-manager/modules/programs/firefox.nix
@@ -23,8 +23,15 @@ let
then "${firefoxConfigPath}/Profiles"
else firefoxConfigPath;
+ # The extensions path shared by all profiles; will not be supported
+ # by future Firefox versions.
extensionPath = "extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
+ extensionsEnvPkg = pkgs.buildEnv {
+ name = "hm-firefox-extensions";
+ paths = cfg.extensions;
+ };
+
profiles =
flip mapAttrs' cfg.profiles (_: profile:
nameValuePair "Profile${toString profile.id}" {
@@ -59,6 +66,13 @@ in
{
meta.maintainers = [ maintainers.rycee ];
+ imports = [
+ (mkRemovedOptionModule ["programs" "firefox" "enableGoogleTalk"]
+ "Support for this option has been removed.")
+ (mkRemovedOptionModule ["programs" "firefox" "enableIcedTea"]
+ "Support for this option has been removed.")
+ ];
+
options = {
programs.firefox = {
enable = mkEnableOption "Firefox";
@@ -87,9 +101,29 @@ in
]
'';
description = ''
- List of Firefox add-on packages to install. Note, it is
- necessary to manually enable these extensions inside Firefox
- after the first installation.
+ List of Firefox add-on packages to install. Some
+ pre-packaged add-ons are accessible from NUR,
+ <link xlink:href="https://github.com/nix-community/NUR"/>.
+ Once you have NUR installed run
+
+ <screen language="console">
+ <prompt>$</prompt> <userinput>nix-env -f '&lt;nixpkgs&gt;' -qaP -A nur.repos.rycee.firefox-addons</userinput>
+ </screen>
+
+ to list the available Firefox add-ons.
+
+ </para><para>
+
+ Note that it is necessary to manually enable these
+ extensions inside Firefox after the first installation.
+
+ </para><para>
+
+ Extensions listed here will only be available in Firefox
+ profiles managed through the
+ <link linkend="opt-programs.firefox.profiles">programs.firefox.profiles</link>
+ option. This is due to recent changes in the way Firefox
+ handles extension side-loading.
'';
};
@@ -137,7 +171,7 @@ in
userChrome = mkOption {
type = types.lines;
default = "";
- description = "Custom Firefox CSS.";
+ description = "Custom Firefox user chrome CSS.";
example = ''
/* Hide tab bar in FF Quantum */
@-moz-document url("chrome://browser/content/browser.xul") {
@@ -153,6 +187,16 @@ in
'';
};
+ userContent = mkOption {
+ type = types.lines;
+ default = "";
+ description = "Custom Firefox user content CSS.";
+ example = ''
+ /* Hide scrollbar in FF Quantum */
+ *{scrollbar-width:none !important}
+ '';
+ };
+
path = mkOption {
type = types.str;
default = name;
@@ -176,38 +220,6 @@ in
default = false;
description = "Whether to enable the unfree Adobe Flash plugin.";
};
-
- enableGoogleTalk = mkOption {
- type = types.bool;
- default = false;
- description = ''
- Whether to enable the unfree Google Talk plugin. This option
- is <emphasis>deprecated</emphasis> and will only work if
-
- <programlisting language="nix">
- programs.firefox.package = pkgs.firefox-esr-52-unwrapped;
- </programlisting>
-
- and the <option>plugin.load_flash_only</option> Firefox
- option has been disabled.
- '';
- };
-
- enableIcedTea = mkOption {
- type = types.bool;
- default = false;
- description = ''
- Whether to enable the Java applet plugin. This option is
- <emphasis>deprecated</emphasis> and will only work if
-
- <programlisting language="nix">
- programs.firefox.package = pkgs.firefox-esr-52-unwrapped;
- </programlisting>
-
- and the <option>plugin.load_flash_only</option> Firefox
- option has been disabled.
- '';
- };
};
};
@@ -250,8 +262,6 @@ in
# The configuration expected by the Firefox wrapper.
fcfg = {
enableAdobeFlash = cfg.enableAdobeFlash;
- enableGoogleTalkPlugin = cfg.enableGoogleTalk;
- icedtea = cfg.enableIcedTea;
};
# A bit of hackery to force a config into the wrapper.
@@ -273,17 +283,10 @@ in
home.file = mkMerge (
[{
- "${mozillaConfigPath}/${extensionPath}" = mkIf (cfg.extensions != []) (
- let
- extensionsEnv = pkgs.buildEnv {
- name = "hm-firefox-extensions";
- paths = cfg.extensions;
- };
- in {
- source = "${extensionsEnv}/share/mozilla/${extensionPath}";
- recursive = true;
- }
- );
+ "${mozillaConfigPath}/${extensionPath}" = mkIf (cfg.extensions != []) {
+ source = "${extensionsEnvPkg}/share/mozilla/${extensionPath}";
+ recursive = true;
+ };
"${firefoxConfigPath}/profiles.ini" = mkIf (cfg.profiles != {}) {
text = profilesIni;
@@ -295,10 +298,21 @@ in
text = profile.userChrome;
};
+ "${profilesPath}/${profile.path}/chrome/userContent.css" =
+ mkIf (profile.userContent != "") {
+ text = profile.userContent;
+ };
+
"${profilesPath}/${profile.path}/user.js" =
mkIf (profile.settings != {} || profile.extraConfig != "") {
text = mkUserJs profile.settings profile.extraConfig;
};
+
+ "${profilesPath}/${profile.path}/extensions" = mkIf (cfg.extensions != []) {
+ source = "${extensionsEnvPkg}/share/mozilla/${extensionPath}";
+ recursive = true;
+ force = true;
+ };
})
);
};