diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0cd109da2..2033b1c24 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -148,6 +148,8 @@ Makefile @thiagokokada /modules/programs/lf.nix @owm111 /tests/modules/programs/lf @owm111 +/modules/programs/librewolf.nix @onny + /modules/programs/lieer.nix @tadfisher /modules/programs/lsd.nix @marsam diff --git a/modules/misc/news.nix b/modules/misc/news.nix index aaceacca0..939917d09 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -597,6 +597,14 @@ in migrate the blur settings to use 'services.picom.settings' instead. ''; } + + { + time = "2022-07-13T13:28:54+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'programs.librewolf'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index c40282e58..6a423f3c5 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -98,6 +98,7 @@ let ./programs/less.nix ./programs/lesspipe.nix ./programs/lf.nix + ./programs/librewolf.nix ./programs/lieer.nix ./programs/lsd.nix ./programs/man.nix diff --git a/modules/programs/librewolf.nix b/modules/programs/librewolf.nix new file mode 100644 index 000000000..c268a5261 --- /dev/null +++ b/modules/programs/librewolf.nix @@ -0,0 +1,59 @@ +{ 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 + + 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; + }; +}