1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00
home-manager/modules/programs/librewolf.nix
Austin Horstman 753ea0b324 librewolf: allow bookmark configuration
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-07-06 12:50:40 -05:00

76 lines
1.8 KiB
Nix

{ config, lib, ... }:
let
cfg = config.programs.librewolf;
mkOverridesFile = prefs: ''
// Generated by Home Manager.
${lib.concatStrings (
lib.mapAttrsToList (name: value: ''
defaultPref("${name}", ${builtins.toJSON value});
'') prefs
)}
'';
modulePath = [
"programs"
"librewolf"
];
mkFirefoxModule = import ./firefox/mkFirefoxModule.nix;
in
{
meta.maintainers = with lib.maintainers; [
chayleaf
onny
];
imports = [
(mkFirefoxModule {
inherit modulePath;
name = "LibreWolf";
description = "LibreWolf is a privacy enhanced Firefox fork.";
wrappedPackageName = "librewolf";
unwrappedPackageName = "librewolf-unwrapped";
visible = true;
platforms.linux = {
configPath = ".librewolf";
};
platforms.darwin = {
configPath = "Library/Application Support/LibreWolf";
};
})
];
options.programs.librewolf = {
settings = lib.mkOption {
type = with lib.types; attrsOf (either bool (either int str));
default = { };
example = lib.literalExpression ''
{
"webgl.disabled" = false;
"privacy.resistFingerprinting" = false;
}
'';
description = ''
Attribute set of global LibreWolf settings and overrides. Refer to
<https://librewolf.net/docs/settings/>
for details on supported values.
'';
};
};
config = lib.mkIf cfg.enable {
home.file.".librewolf/librewolf.overrides.cfg" = lib.mkIf (cfg.settings != { }) {
text = mkOverridesFile cfg.settings;
};
mozilla.librewolfNativeMessagingHosts =
cfg.nativeMessagingHosts
# package configured native messaging hosts (entire browser actually)
++ (lib.optional (cfg.finalPackage != null) cfg.finalPackage);
};
}