nixos/firefox: lint

This commit is contained in:
linsui 2022-11-18 11:01:28 +08:00
parent 6120738eaa
commit b9778b3a95

View file

@ -15,15 +15,15 @@ let
given control of your browser, unless of course they also control your given control of your browser, unless of course they also control your
NixOS configuration. NixOS configuration.
''; '';
in
in { {
options.programs.firefox = { options.programs.firefox = {
enable = mkEnableOption (mdDoc "the Firefox web browser"); enable = mkEnableOption (mdDoc "the Firefox web browser");
package = mkOption { package = mkOption {
description = mdDoc "Firefox package to use.";
type = types.package; type = types.package;
default = pkgs.firefox; default = pkgs.firefox;
description = mdDoc "Firefox package to use.";
defaultText = literalExpression "pkgs.firefox"; defaultText = literalExpression "pkgs.firefox";
relatedPackages = [ relatedPackages = [
"firefox" "firefox"
@ -37,6 +37,8 @@ in {
}; };
policies = mkOption { policies = mkOption {
type = policyFormat.type;
default = { };
description = mdDoc '' description = mdDoc ''
Group policies to install. Group policies to install.
@ -48,21 +50,19 @@ in {
${organisationInfo} ${organisationInfo}
''; '';
type = policyFormat.type;
default = {};
}; };
preferences = mkOption { preferences = mkOption {
type = with types; attrsOf (oneOf [ bool int string ]);
default = { };
description = mdDoc '' description = mdDoc ''
Preferences to set from `about://config`. Preferences to set from `about:config`.
Some of these might be able to be configured more ergonomically Some of these might be able to be configured more ergonomically
using policies. using policies.
${organisationInfo} ${organisationInfo}
''; '';
type = with types; attrsOf (oneOf [ bool int string ]);
default = {};
}; };
}; };
@ -78,14 +78,11 @@ in {
}; };
# Preferences are converted into a policy # Preferences are converted into a policy
programs.firefox.policies = programs.firefox.policies = mkIf (cfg.preferences != { }) {
mkIf (cfg.preferences != {}) Preferences = (mapAttrs
{ (name: value: { Value = value; Status = cfg.preferencesStatus; })
Preferences = (mapAttrs (name: value: { cfg.preferences);
Value = value; };
Status = "locked";
}) cfg.preferences);
};
}; };
meta.maintainers = with maintainers; [ danth ]; meta.maintainers = with maintainers; [ danth ];