From a9e3779949925ef22f5a215c5f49cf520dea30b1 Mon Sep 17 00:00:00 2001 From: awwpotato <153149335+awwpotato@users.noreply.github.com> Date: Fri, 13 Dec 2024 09:16:08 -0800 Subject: [PATCH] librewolf: init (#679) Link: https://github.com/danth/stylix/pull/679 Co-authored-by: Daniel Thwaites Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com> --- modules/firefox/hm.nix | 3 +++ modules/librewolf/hm.nix | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 modules/librewolf/hm.nix diff --git a/modules/firefox/hm.nix b/modules/firefox/hm.nix index 6e8f2ee7..d8d49a6d 100644 --- a/modules/firefox/hm.nix +++ b/modules/firefox/hm.nix @@ -1,3 +1,6 @@ +# Consider also updating the LibreWolf module when updating this module, +# as they are very similar. + { config, lib, ... }: let diff --git a/modules/librewolf/hm.nix b/modules/librewolf/hm.nix new file mode 100644 index 00000000..3d1692f5 --- /dev/null +++ b/modules/librewolf/hm.nix @@ -0,0 +1,31 @@ +# This module is a copy of the Firefox module. + +{ config, lib, ... }: + +let + profileSettings = { + settings = { + "font.name.monospace.x-western" = config.stylix.fonts.monospace.name; + "font.name.sans-serif.x-western" = config.stylix.fonts.sansSerif.name; + "font.name.serif.x-western" = config.stylix.fonts.serif.name; + }; + }; + makeProfileSettingsPair = profileName: + lib.nameValuePair profileName profileSettings; +in { + options.stylix.targets.librewolf = { + enable = + config.lib.stylix.mkEnableTarget "Librewolf" true; + + profileNames = lib.mkOption { + description = "The Librewolf profile names to apply styling on."; + type = lib.types.listOf lib.types.str; + default = [ ]; + }; + }; + + config = lib.mkIf (config.stylix.enable && config.stylix.targets.librewolf.enable) { + programs.librewolf.profiles = lib.listToAttrs + (map makeProfileSettingsPair config.stylix.targets.librewolf.profileNames); + }; +}