mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
firefox: use wrapped package
This makes the programs.firefox.package option take a pre-wrapped Firefox package as value if state version is set to "19.09" or later. This should make the Firefox module work with a wider range of Firefox packages.
This commit is contained in:
parent
c2429ca0cf
commit
73641e492c
7 changed files with 99 additions and 12 deletions
|
@ -9,4 +9,27 @@
|
||||||
This is the current unstable branch and the information in this section is
|
This is the current unstable branch and the information in this section is
|
||||||
therefore not final.
|
therefore not final.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<section xmlns="http://docbook.org/ns/docbook"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||||
|
version="5.0"
|
||||||
|
xml:id="sec-release-19.09-state-version-changes">
|
||||||
|
<title>State Version Changes</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The state version in this release includes the changes below. These changes
|
||||||
|
are only active if the <option>home.stateVersion</option> option is set to
|
||||||
|
"19.09" or later.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
The <option>programs.firefox.package</option> option now expects a wrapped
|
||||||
|
Firefox package and defaults to <code>pkgs.firefox</code>.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</itemizedlist>
|
||||||
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -45,9 +45,16 @@ in
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.firefox-unwrapped;
|
default =
|
||||||
defaultText = "pkgs.firefox-unwrapped";
|
if versionAtLeast config.home.stateVersion "19.09"
|
||||||
description = "The unwrapped Firefox package to use.";
|
then pkgs.firefox
|
||||||
|
else pkgs.firefox-unwrapped;
|
||||||
|
defaultText = "pkgs.firefox";
|
||||||
|
description = ''
|
||||||
|
The Firefox package to use. If state version ≥ 19.09 then
|
||||||
|
this should be a wrapped Firefox package. For earlier state
|
||||||
|
versions it should be an unwrapped Firefox package.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
extensions = mkOption {
|
extensions = mkOption {
|
||||||
|
@ -220,21 +227,26 @@ in
|
||||||
|
|
||||||
home.packages =
|
home.packages =
|
||||||
let
|
let
|
||||||
# A bit of hackery to force a config into the wrapper.
|
# The configuration expected by the Firefox wrapper.
|
||||||
browserName = cfg.package.browserName
|
fcfg = {
|
||||||
or (builtins.parseDrvName cfg.package.name).name;
|
|
||||||
|
|
||||||
fcfg = setAttrByPath [browserName] {
|
|
||||||
enableAdobeFlash = cfg.enableAdobeFlash;
|
enableAdobeFlash = cfg.enableAdobeFlash;
|
||||||
enableGoogleTalkPlugin = cfg.enableGoogleTalk;
|
enableGoogleTalkPlugin = cfg.enableGoogleTalk;
|
||||||
icedtea = cfg.enableIcedTea;
|
icedtea = cfg.enableIcedTea;
|
||||||
};
|
};
|
||||||
|
|
||||||
wrapper = pkgs.wrapFirefox.override {
|
# A bit of hackery to force a config into the wrapper.
|
||||||
config = fcfg;
|
browserName = cfg.package.browserName
|
||||||
};
|
or (builtins.parseDrvName cfg.package.name).name;
|
||||||
|
|
||||||
|
# The configuration expected by the Firefox wrapper builder.
|
||||||
|
bcfg = setAttrByPath [browserName] fcfg;
|
||||||
|
|
||||||
|
package =
|
||||||
|
if versionAtLeast config.home.stateVersion "19.09"
|
||||||
|
then cfg.package.override { cfg = fcfg; }
|
||||||
|
else (pkgs.wrapFirefox.override { config = bcfg; }) cfg.package { };
|
||||||
in
|
in
|
||||||
[ (wrapper cfg.package { }) ];
|
[ package ];
|
||||||
|
|
||||||
home.file = mkMerge (
|
home.file = mkMerge (
|
||||||
[{
|
[{
|
||||||
|
|
|
@ -35,6 +35,7 @@ import nmt {
|
||||||
}
|
}
|
||||||
// import ./modules/misc/pam
|
// import ./modules/misc/pam
|
||||||
// import ./modules/misc/xsession
|
// import ./modules/misc/xsession
|
||||||
|
// import ./modules/programs/firefox
|
||||||
// import ./modules/systemd
|
// import ./modules/systemd
|
||||||
)
|
)
|
||||||
// import ./modules/home-environment
|
// import ./modules/home-environment
|
||||||
|
|
4
tests/modules/programs/firefox/default.nix
Normal file
4
tests/modules/programs/firefox/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
firefox-profile-settings = ./profile-settings.nix;
|
||||||
|
firefox-state-version-19_09 = ./state-version-19_09.nix;
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
// Generated by Home Manager.
|
||||||
|
|
||||||
|
user_pref("general.smoothScroll", false);
|
||||||
|
|
||||||
|
|
||||||
|
|
24
tests/modules/programs/firefox/profile-settings.nix
Normal file
24
tests/modules/programs/firefox/profile-settings.nix
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
programs.firefox = {
|
||||||
|
enable = true;
|
||||||
|
profiles.test.settings = {
|
||||||
|
"general.smoothScroll" = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileRegex \
|
||||||
|
home-path/bin/firefox \
|
||||||
|
MOZ_APP_LAUNCHER
|
||||||
|
|
||||||
|
assertFileContent \
|
||||||
|
home-files/.mozilla/firefox/test/user.js \
|
||||||
|
${./profile-settings-expected-user.js}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
17
tests/modules/programs/firefox/state-version-19_09.nix
Normal file
17
tests/modules/programs/firefox/state-version-19_09.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
home.stateVersion = "19.09";
|
||||||
|
|
||||||
|
programs.firefox.enable = true;
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileRegex \
|
||||||
|
home-path/bin/firefox \
|
||||||
|
MOZ_APP_LAUNCHER
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue