Skip to content

Commit

Permalink
firefox: leverage Home Manager's mkFirefoxModule pattern (#695)
Browse files Browse the repository at this point in the history
Leverage Home Manager's mkFirefoxModule pattern introduced in commit
792757f643ce [1] ("firefox: support firefox derivatives").

[1]: nix-community/home-manager@792757f

Reviewed-by: NAHO <[email protected]>
Tested-by: NAHO <[email protected]>
(cherry picked from commit 079fece)
  • Loading branch information
brckd authored and github-actions[bot] committed Jan 4, 2025
1 parent c6eecbe commit 7db5e36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 39 deletions.
20 changes: 12 additions & 8 deletions modules/firefox/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
31 changes: 0 additions & 31 deletions modules/librewolf/hm.nix

This file was deleted.

0 comments on commit 7db5e36

Please sign in to comment.