2022-03-14 12:53:42 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.librewolf;
|
|
|
|
|
|
|
|
mkOverridesFile = prefs: ''
|
|
|
|
// Generated by Home Manager.
|
|
|
|
|
|
|
|
${concatStrings (mapAttrsToList (name: value: ''
|
|
|
|
defaultPref("${name}", ${builtins.toJSON value});
|
|
|
|
'') prefs)}
|
|
|
|
'';
|
|
|
|
|
|
|
|
in {
|
|
|
|
meta.maintainers = [ maintainers.onny ];
|
|
|
|
|
|
|
|
options.programs.librewolf = {
|
2023-07-01 01:30:13 +02:00
|
|
|
enable = mkEnableOption
|
|
|
|
(lib.mdDoc "Librewolf browser, a privacy enhanced Firefox fork");
|
2022-03-14 12:53:42 +01:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.librewolf;
|
|
|
|
defaultText = literalExpression "pkgs.librewolf";
|
2023-07-01 01:30:13 +02:00
|
|
|
description = lib.mdDoc "The LibreWolf package to use.";
|
2022-03-14 12:53:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = with types; attrsOf (either bool (either int str));
|
|
|
|
default = { };
|
|
|
|
example = literalExpression ''
|
|
|
|
{
|
|
|
|
"webgl.disabled" = false;
|
|
|
|
"privacy.resistFingerprinting" = false;
|
|
|
|
}
|
|
|
|
'';
|
2023-07-01 01:30:13 +02:00
|
|
|
description = lib.mdDoc ''
|
2022-03-14 12:53:42 +01:00
|
|
|
Attribute set of LibreWolf settings and overrides. Refer to
|
2023-07-01 01:30:13 +02:00
|
|
|
<https://librewolf.net/docs/settings/>
|
2022-03-14 12:53:42 +01:00
|
|
|
for details on supported values.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
assertions = [
|
|
|
|
(lib.hm.assertions.assertPlatform "programs.librewolf" pkgs
|
|
|
|
lib.platforms.linux)
|
|
|
|
];
|
|
|
|
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
|
|
|
home.file.".librewolf/librewolf.overrides.cfg".text =
|
|
|
|
mkOverridesFile cfg.settings;
|
|
|
|
};
|
|
|
|
}
|