firefox: leverage Home Manager's mkFirefoxModule pattern (#695)
Leverage Home Manager's mkFirefoxModule pattern introduced in commit
792757f643ce [1] ("firefox: support firefox derivatives").
[1]: 792757f643
Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
Tested-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
parent
a70154ec03
commit
079fecebad
2 changed files with 12 additions and 39 deletions
|
|
@ -13,20 +13,24 @@ let
|
|||
};
|
||||
makeProfileSettingsPair = profileName:
|
||||
lib.nameValuePair profileName profileSettings;
|
||||
derivatives = [
|
||||
{path = "firefox"; name = "Firefox";}
|
||||
{path = "librewolf"; name = "LibreWolf";}
|
||||
];
|
||||
in {
|
||||
options.stylix.targets.firefox = {
|
||||
options.stylix.targets = lib.listToAttrs (map (drv: lib.nameValuePair drv.path {
|
||||
enable =
|
||||
config.lib.stylix.mkEnableTarget "Firefox" true;
|
||||
config.lib.stylix.mkEnableTarget drv.name true;
|
||||
|
||||
profileNames = lib.mkOption {
|
||||
description = "The Firefox profile names to apply styling on.";
|
||||
description = "The ${drv.name} profile names to apply styling on.";
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
}) derivatives);
|
||||
|
||||
config = lib.mkIf (config.stylix.enable && config.stylix.targets.firefox.enable) {
|
||||
programs.firefox.profiles = lib.listToAttrs
|
||||
(map makeProfileSettingsPair config.stylix.targets.firefox.profileNames);
|
||||
};
|
||||
config = lib.mkMerge (map (drv: lib.mkIf (config.stylix.enable && config.stylix.targets.${drv.path}.enable) {
|
||||
programs.${drv.path}.profiles = lib.listToAttrs
|
||||
(map makeProfileSettingsPair config.stylix.targets.${drv.path}.profileNames);
|
||||
}) derivatives);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
# 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);
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue