about summary refs log tree commit diff
path: root/nixos/modules/programs
diff options
context:
space:
mode:
authorlinsui <linsui555@gmail.com>2022-11-18 11:01:28 +0800
committerlinsui <linsui555@gmail.com>2022-11-19 17:50:51 +0800
commitb9778b3a9555a571b019e4dec5434e5e470c1ece (patch)
treeab4654e59a33e89bf959381a14bdc9a695cbd721 /nixos/modules/programs
parent6120738eaad48d46ec81f90c62762886fc557c37 (diff)
nixos/firefox: lint
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r--nixos/modules/programs/firefox.nix29
1 files changed, 13 insertions, 16 deletions
diff --git a/nixos/modules/programs/firefox.nix b/nixos/modules/programs/firefox.nix
index c1bb0b3e36120..0d162922f57ae 100644
--- a/nixos/modules/programs/firefox.nix
+++ b/nixos/modules/programs/firefox.nix
@@ -15,15 +15,15 @@ let
     given control of your browser, unless of course they also control your
     NixOS configuration.
   '';
-
-in {
+in
+{
   options.programs.firefox = {
     enable = mkEnableOption (mdDoc "the Firefox web browser");
 
     package = mkOption {
-      description = mdDoc "Firefox package to use.";
       type = types.package;
       default = pkgs.firefox;
+      description = mdDoc "Firefox package to use.";
       defaultText = literalExpression "pkgs.firefox";
       relatedPackages = [
         "firefox"
@@ -37,6 +37,8 @@ in {
     };
 
     policies = mkOption {
+      type = policyFormat.type;
+      default = { };
       description = mdDoc ''
         Group policies to install.
 
@@ -48,21 +50,19 @@ in {
 
         ${organisationInfo}
       '';
-      type = policyFormat.type;
-      default = {};
     };
 
     preferences = mkOption {
+      type = with types; attrsOf (oneOf [ bool int string ]);
+      default = { };
       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
         using policies.
 
         ${organisationInfo}
       '';
-      type = with types; attrsOf (oneOf [ bool int string ]);
-      default = {};
     };
   };
 
@@ -78,14 +78,11 @@ in {
       };
 
     # Preferences are converted into a policy
-    programs.firefox.policies =
-      mkIf (cfg.preferences != {})
-      {
-        Preferences = (mapAttrs (name: value: {
-          Value = value;
-          Status = "locked";
-        }) cfg.preferences);
-      };
+    programs.firefox.policies = mkIf (cfg.preferences != { }) {
+      Preferences = (mapAttrs
+        (name: value: { Value = value; Status = cfg.preferencesStatus; })
+        cfg.preferences);
+    };
   };
 
   meta.maintainers = with maintainers; [ danth ];