firefox: restore compatibility for extraPolicies
This commit makes it possible to specify Firefox' extraPolicies
through:
programs.firefox.package = pkgs.firefox.override {
extraPolicies = {... }
}
This was possible in the past but was broken by:
3feeb77155
firefox: add support for specifying policies (#4626)
This commit is contained in:
parent
fa152fd745
commit
bf4b576f84
|
@ -172,7 +172,7 @@ let
|
||||||
else if versionAtLeast config.home.stateVersion "19.09" then
|
else if versionAtLeast config.home.stateVersion "19.09" then
|
||||||
package.override (old: {
|
package.override (old: {
|
||||||
cfg = old.cfg or { } // fcfg;
|
cfg = old.cfg or { } // fcfg;
|
||||||
extraPolicies = cfg.policies;
|
extraPolicies = (old.extraPolicies or { }) // cfg.policies;
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
(pkgs.wrapFirefox.override { config = bcfg; }) package { };
|
(pkgs.wrapFirefox.override { config = bcfg; }) package { };
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
programs.firefox = {
|
programs.firefox = {
|
||||||
enable = true;
|
enable = true;
|
||||||
policies = { BlockAboutConfig = true; };
|
policies = { BlockAboutConfig = true; };
|
||||||
|
package = pkgs.firefox.override {
|
||||||
|
extraPolicies = { DownloadDirectory = "/foo"; };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
|
@ -16,11 +19,18 @@
|
||||||
config_file="${config.programs.firefox.finalPackage}/lib/firefox/distribution/policies.json"
|
config_file="${config.programs.firefox.finalPackage}/lib/firefox/distribution/policies.json"
|
||||||
|
|
||||||
assertFileExists "$config_file"
|
assertFileExists "$config_file"
|
||||||
|
|
||||||
blockAboutConfig_actual_value="$($jq ".policies.BlockAboutConfig" $config_file)"
|
blockAboutConfig_actual_value="$($jq ".policies.BlockAboutConfig" $config_file)"
|
||||||
|
|
||||||
if [[ $blockAboutConfig_actual_value != "true" ]]; then
|
if [[ $blockAboutConfig_actual_value != "true" ]]; then
|
||||||
fail "Expected '$config_file' to set 'policies.BlockAboutConfig' to true"
|
fail "Expected '$config_file' to set 'policies.BlockAboutConfig' to true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
downloadDirectory_actual_value="$($jq ".policies.DownloadDirectory" $config_file)"
|
||||||
|
|
||||||
|
if [[ $downloadDirectory_actual_value != "\"/foo\"" ]]; then
|
||||||
|
fail "Expected '$config_file' to set 'policies.DownloadDirectory' to \"/foo\""
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue