librewolf: use mkFirefoxModule

This commit is contained in:
chayleaf 2024-07-29 17:27:11 +07:00
parent 792757f643
commit a0ba4158d9
No known key found for this signature in database
GPG key ID: 78171AD46227E68E

View file

@ -14,20 +14,33 @@ let
'') prefs)}
'';
modulePath = [ "programs" "librewolf" ];
mkFirefoxModule = import ./firefox/mkFirefoxModule.nix;
in {
meta.maintainers = [ maintainers.onny ];
meta.maintainers = [ maintainers.chayleaf maintainers.onny ];
imports = [
(mkFirefoxModule {
inherit modulePath;
name = "LibreWolf";
wrappedPackageName = "librewolf";
unwrappedPackageName = "librewolf-unwrapped";
visible = true;
platforms.linux = {
vendorPath = ".librewolf";
configPath = ".librewolf";
};
platforms.darwin = {
vendorPath = "Library/Application Support/LibreWolf";
configPath = "Library/Application Support/LibreWolf";
};
})
];
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 LibreWolf package to use.";
};
settings = mkOption {
type = with types; attrsOf (either bool (either int str));
default = { };
@ -38,7 +51,7 @@ in {
}
'';
description = ''
Attribute set of LibreWolf settings and overrides. Refer to
Attribute set of global LibreWolf settings and overrides. Refer to
<https://librewolf.net/docs/settings/>
for details on supported values.
'';
@ -53,7 +66,8 @@ in {
home.packages = [ cfg.package ];
home.file.".librewolf/librewolf.overrides.cfg".text =
mkOverridesFile cfg.settings;
home.file.".librewolf/librewolf.overrides.cfg" = lib.mkIf (cfg.settings != { }) {
text = mkOverridesFile cfg.settings;
};
};
}