firefox: add darwin support
This commit is contained in:
parent
a0ab0b16fe
commit
f66cc1b851
|
@ -4,15 +4,35 @@ with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
||||||
|
|
||||||
cfg = config.programs.firefox;
|
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}";
|
extensionPath = "extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
|
||||||
|
|
||||||
profiles =
|
profiles =
|
||||||
flip mapAttrs' cfg.profiles (_: profile:
|
flip mapAttrs' cfg.profiles (_: profile:
|
||||||
nameValuePair "Profile${toString profile.id}" {
|
nameValuePair "Profile${toString profile.id}" {
|
||||||
Name = profile.name;
|
Name = profile.name;
|
||||||
Path = profile.path;
|
Path =
|
||||||
|
if isDarwin
|
||||||
|
then "Profiles/${profile.path}"
|
||||||
|
else profile.path;
|
||||||
IsRelative = 1;
|
IsRelative = 1;
|
||||||
Default = if profile.isDefault then 1 else 0;
|
Default = if profile.isDefault then 1 else 0;
|
||||||
}
|
}
|
||||||
|
@ -242,15 +262,18 @@ in
|
||||||
bcfg = setAttrByPath [browserName] fcfg;
|
bcfg = setAttrByPath [browserName] fcfg;
|
||||||
|
|
||||||
package =
|
package =
|
||||||
if versionAtLeast config.home.stateVersion "19.09"
|
if isDarwin then
|
||||||
then cfg.package.override { cfg = fcfg; }
|
cfg.package
|
||||||
else (pkgs.wrapFirefox.override { config = bcfg; }) 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
|
in
|
||||||
[ package ];
|
[ package ];
|
||||||
|
|
||||||
home.file = mkMerge (
|
home.file = mkMerge (
|
||||||
[{
|
[{
|
||||||
".mozilla/${extensionPath}" = mkIf (cfg.extensions != []) (
|
"${mozillaConfigPath}/${extensionPath}" = mkIf (cfg.extensions != []) (
|
||||||
let
|
let
|
||||||
extensionsEnv = pkgs.buildEnv {
|
extensionsEnv = pkgs.buildEnv {
|
||||||
name = "hm-firefox-extensions";
|
name = "hm-firefox-extensions";
|
||||||
|
@ -262,17 +285,17 @@ in
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
".mozilla/firefox/profiles.ini" = mkIf (cfg.profiles != {}) {
|
"${firefoxConfigPath}/profiles.ini" = mkIf (cfg.profiles != {}) {
|
||||||
text = profilesIni;
|
text = profilesIni;
|
||||||
};
|
};
|
||||||
}]
|
}]
|
||||||
++ flip mapAttrsToList cfg.profiles (_: profile: {
|
++ flip mapAttrsToList cfg.profiles (_: profile: {
|
||||||
".mozilla/firefox/${profile.path}/chrome/userChrome.css" =
|
"${profilesPath}/${profile.path}/chrome/userChrome.css" =
|
||||||
mkIf (profile.userChrome != "") {
|
mkIf (profile.userChrome != "") {
|
||||||
text = profile.userChrome;
|
text = profile.userChrome;
|
||||||
};
|
};
|
||||||
|
|
||||||
".mozilla/firefox/${profile.path}/user.js" =
|
"${profilesPath}/${profile.path}/user.js" =
|
||||||
mkIf (profile.settings != {} || profile.extraConfig != "") {
|
mkIf (profile.settings != {} || profile.extraConfig != "") {
|
||||||
text = mkUserJs profile.settings profile.extraConfig;
|
text = mkUserJs profile.settings profile.extraConfig;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue