From a0ba4158d98443568ffaa0352c944303ba33f025 Mon Sep 17 00:00:00 2001 From: chayleaf Date: Mon, 29 Jul 2024 17:27:11 +0700 Subject: [PATCH] librewolf: use mkFirefoxModule --- modules/programs/librewolf.nix | 42 ++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/modules/programs/librewolf.nix b/modules/programs/librewolf.nix index d8b6dfab..763be41b 100644 --- a/modules/programs/librewolf.nix +++ b/modules/programs/librewolf.nix @@ -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 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; + }; }; }