summaryrefslogtreecommitdiffstats
path: root/nixos/modules/programs/firefox.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/programs/firefox.nix')
-rw-r--r--nixos/modules/programs/firefox.nix52
1 files changed, 25 insertions, 27 deletions
diff --git a/nixos/modules/programs/firefox.nix b/nixos/modules/programs/firefox.nix
index 39b30be48de9..f698c3999dc1 100644
--- a/nixos/modules/programs/firefox.nix
+++ b/nixos/modules/programs/firefox.nix
@@ -1,7 +1,5 @@
{ pkgs, config, lib, ... }:
-with lib;
-
let
cfg = config.programs.firefox;
@@ -62,13 +60,13 @@ let
in
{
options.programs.firefox = {
- enable = mkEnableOption "the Firefox web browser";
+ enable = lib.mkEnableOption "the Firefox web browser";
- package = mkOption {
- type = types.package;
+ package = lib.mkOption {
+ type = lib.types.package;
default = pkgs.firefox;
description = "Firefox package to use.";
- defaultText = literalExpression "pkgs.firefox";
+ defaultText = lib.literalExpression "pkgs.firefox";
relatedPackages = [
"firefox"
"firefox-beta-bin"
@@ -78,13 +76,13 @@ in
];
};
- wrapperConfig = mkOption {
- type = types.attrs;
+ wrapperConfig = lib.mkOption {
+ type = lib.types.attrs;
default = {};
description = "Arguments to pass to Firefox wrapper";
};
- policies = mkOption {
+ policies = lib.mkOption {
type = policyFormat.type;
default = { };
description = ''
@@ -100,8 +98,8 @@ in
'';
};
- preferences = mkOption {
- type = with types; attrsOf (oneOf [ bool int str ]);
+ preferences = lib.mkOption {
+ type = with lib.types; attrsOf (oneOf [ bool int str ]);
default = { };
description = ''
Preferences to set from `about:config`.
@@ -113,8 +111,8 @@ in
'';
};
- preferencesStatus = mkOption {
- type = types.enum [ "default" "locked" "user" "clear" ];
+ preferencesStatus = lib.mkOption {
+ type = lib.types.enum [ "default" "locked" "user" "clear" ];
default = "locked";
description = ''
The status of `firefox.preferences`.
@@ -127,9 +125,9 @@ in
'';
};
- languagePacks = mkOption {
+ languagePacks = lib.mkOption {
# Available languages can be found in https://releases.mozilla.org/pub/firefox/releases/${cfg.package.version}/linux-x86_64/xpi/
- type = types.listOf (types.enum ([
+ type = lib.types.listOf (lib.types.enum ([
"ach"
"af"
"an"
@@ -235,8 +233,8 @@ in
'';
};
- autoConfig = mkOption {
- type = types.lines;
+ autoConfig = lib.mkOption {
+ type = lib.types.lines;
default = "";
description = ''
AutoConfig files can be used to set and lock preferences that are not covered
@@ -247,19 +245,19 @@ in
};
nativeMessagingHosts = ({
- packages = mkOption {
- type = types.listOf types.package;
+ packages = lib.mkOption {
+ type = lib.types.listOf lib.types.package;
default = [];
description = ''
Additional packages containing native messaging hosts that should be made available to Firefox extensions.
'';
};
- }) // (mapAttrs (k: v: mkEnableOption "${v.name} support") nmhOptions);
+ }) // (builtins.mapAttrs (k: v: lib.mkEnableOption "${v.name} support") nmhOptions);
};
config = let
- forEachEnabledNmh = fn: flatten (mapAttrsToList (k: v: lib.optional cfg.nativeMessagingHosts.${k} (fn k v)) nmhOptions);
- in mkIf cfg.enable {
+ forEachEnabledNmh = fn: lib.flatten (lib.mapAttrsToList (k: v: lib.optional cfg.nativeMessagingHosts.${k} (fn k v)) nmhOptions);
+ in lib.mkIf cfg.enable {
warnings = forEachEnabledNmh (k: v:
"The `programs.firefox.nativeMessagingHosts.${k}` option is deprecated, " +
"please add `${v.package.pname}` to `programs.firefox.nativeMessagingHosts.packages` instead."
@@ -278,18 +276,18 @@ in
let
policiesJSON = policyFormat.generate "firefox-policies.json" { inherit (cfg) policies; };
in
- mkIf (cfg.policies != { }) {
+ lib.mkIf (cfg.policies != { }) {
"firefox/policies/policies.json".source = "${policiesJSON}";
};
# Preferences are converted into a policy
programs.firefox.policies = {
DisableAppUpdate = true;
- Preferences = (mapAttrs
+ Preferences = (builtins.mapAttrs
(_: value: { Value = value; Status = cfg.preferencesStatus; })
cfg.preferences);
- ExtensionSettings = listToAttrs (map
- (lang: nameValuePair
+ ExtensionSettings = builtins.listToAttrs (builtins.map
+ (lang: builtins.nameValuePair
"langpack-${lang}@firefox.mozilla.org"
{
installation_mode = "normal_installed";
@@ -300,5 +298,5 @@ in
};
};
- meta.maintainers = with maintainers; [ danth ];
+ meta.maintainers = with lib.maintainers; [ danth ];
}