firefox: prepare for updated sideloading behavior

Co-Authored-By: Cole Helbling <cole.e.helbling@outlook.com>
This commit is contained in:
Robert Helgesson 2020-03-15 18:10:38 +01:00
parent 2681568f2b
commit cc386e4b3b
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
2 changed files with 42 additions and 11 deletions

View file

@ -23,8 +23,15 @@ let
then "${firefoxConfigPath}/Profiles"
else firefoxConfigPath;
# The extensions path shared by all profiles; will not be supported
# by future Firefox versions.
extensionPath = "extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
extensionsEnvPkg = pkgs.buildEnv {
name = "hm-firefox-extensions";
paths = cfg.extensions;
};
profiles =
flip mapAttrs' cfg.profiles (_: profile:
nameValuePair "Profile${toString profile.id}" {
@ -283,17 +290,10 @@ in
home.file = mkMerge (
[{
"${mozillaConfigPath}/${extensionPath}" = mkIf (cfg.extensions != []) (
let
extensionsEnv = pkgs.buildEnv {
name = "hm-firefox-extensions";
paths = cfg.extensions;
};
in {
source = "${extensionsEnv}/share/mozilla/${extensionPath}";
recursive = true;
}
);
"${mozillaConfigPath}/${extensionPath}" = mkIf (cfg.extensions != []) {
source = "${extensionsEnvPkg}/share/mozilla/${extensionPath}";
recursive = true;
};
"${firefoxConfigPath}/profiles.ini" = mkIf (cfg.profiles != {}) {
text = profilesIni;
@ -314,6 +314,11 @@ in
mkIf (profile.settings != {} || profile.extraConfig != "") {
text = mkUserJs profile.settings profile.extraConfig;
};
"${profilesPath}/${profile.path}/extensions" = mkIf (cfg.extensions != []) {
source = "${extensionsEnvPkg}/share/mozilla/${extensionPath}";
recursive = true;
};
})
);
};