aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/programs/firefox.nix
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2020-02-03 10:05:30 +0100
committerKatharina Fey <kookie@spacekookie.de>2020-02-03 10:05:30 +0100
commitc488527c95c874d3b8743c915173ad7bfb05d5af (patch)
tree2b874dc5606a9dff44096a5e8557f00dc52ac2b6 /home-manager/modules/programs/firefox.nix
parent899a451e08f7d6d2c8214d119c2a0316849a0ed4 (diff)
parent6cc4fd6ede4909226cb81d3475834251ed1b7210 (diff)
Merge commit '6cc4fd6ede4909226cb81d3475834251ed1b7210'
Diffstat (limited to 'home-manager/modules/programs/firefox.nix')
-rw-r--r--home-manager/modules/programs/firefox.nix39
1 files changed, 31 insertions, 8 deletions
diff --git a/home-manager/modules/programs/firefox.nix b/home-manager/modules/programs/firefox.nix
index 708b05417d6..17c64752d66 100644
--- a/home-manager/modules/programs/firefox.nix
+++ b/home-manager/modules/programs/firefox.nix
@@ -4,15 +4,35 @@ with lib;
let
+ inherit (pkgs.stdenv.hostPlatform) isDarwin;
+
cfg = config.programs.firefox;
+ mozillaConfigPath =
+ if isDarwin
+ then "Library/Application Support/Mozilla"
+ else ".mozilla";
+
+ firefoxConfigPath =
+ if isDarwin
+ then "Library/Application Support/Firefox"
+ else "${mozillaConfigPath}/firefox";
+
+ profilesPath =
+ if isDarwin
+ then "${firefoxConfigPath}/Profiles"
+ else firefoxConfigPath;
+
extensionPath = "extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
profiles =
flip mapAttrs' cfg.profiles (_: profile:
nameValuePair "Profile${toString profile.id}" {
Name = profile.name;
- Path = profile.path;
+ Path =
+ if isDarwin
+ then "Profiles/${profile.path}"
+ else profile.path;
IsRelative = 1;
Default = if profile.isDefault then 1 else 0;
}
@@ -242,15 +262,18 @@ in
bcfg = setAttrByPath [browserName] fcfg;
package =
- if versionAtLeast config.home.stateVersion "19.09"
- then cfg.package.override { cfg = fcfg; }
- else (pkgs.wrapFirefox.override { config = bcfg; }) cfg.package { };
+ if isDarwin then
+ cfg.package
+ else if versionAtLeast config.home.stateVersion "19.09" then
+ cfg.package.override { cfg = fcfg; }
+ else
+ (pkgs.wrapFirefox.override { config = bcfg; }) cfg.package { };
in
[ package ];
home.file = mkMerge (
[{
- ".mozilla/${extensionPath}" = mkIf (cfg.extensions != []) (
+ "${mozillaConfigPath}/${extensionPath}" = mkIf (cfg.extensions != []) (
let
extensionsEnv = pkgs.buildEnv {
name = "hm-firefox-extensions";
@@ -262,17 +285,17 @@ in
}
);
- ".mozilla/firefox/profiles.ini" = mkIf (cfg.profiles != {}) {
+ "${firefoxConfigPath}/profiles.ini" = mkIf (cfg.profiles != {}) {
text = profilesIni;
};
}]
++ flip mapAttrsToList cfg.profiles (_: profile: {
- ".mozilla/firefox/${profile.path}/chrome/userChrome.css" =
+ "${profilesPath}/${profile.path}/chrome/userChrome.css" =
mkIf (profile.userChrome != "") {
text = profile.userChrome;
};
- ".mozilla/firefox/${profile.path}/user.js" =
+ "${profilesPath}/${profile.path}/user.js" =
mkIf (profile.settings != {} || profile.extraConfig != "") {
text = mkUserJs profile.settings profile.extraConfig;
};