Files
home-manager/modules/programs/librewolf.nix
Austin Horstman 355734d876 treewide: remove literalExpression where unneeded
`literalExpression` is intended just to signify code that needs to stay
a string that gets represented exactly as-is for docs. It has been
misused heavily and people get confused repeatedly on when or not to use
it because of the rampant misuse.
2026-05-17 21:43:25 -05:00

74 lines
1.7 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";
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 = {
"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);
};
}