1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-18 09:09:45 +01:00
home-manager/modules/programs/librewolf.nix

60 lines
1.4 KiB
Nix
Raw Normal View History

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 = {
enable =
mkEnableOption "Librewolf browser, a privacy enhanced Firefox fork";
package = mkOption {
type = types.package;
default = pkgs.librewolf;
defaultText = literalExpression "pkgs.librewolf";
description = "The LibeWolf package to use.";
};
settings = mkOption {
type = with types; attrsOf (either bool (either int str));
default = { };
example = literalExpression ''
{
"webgl.disabled" = false;
"privacy.resistFingerprinting" = false;
}
'';
description = ''
Attribute set of LibreWolf settings and overrides. Refer to
<link xlink:href="https://librewolf.net/docs/settings/"/>
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;
};
}