mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-17 06:21:10 +01:00
mkFirefox: add policy to accept added extensions
This commit adds extensions added via profiles.<name>.extensions.packages to the policy. In consequence the extensions are added without complaint and don't need to be enabled manually.
This commit is contained in:
parent
722792af09
commit
0349c42688
1 changed files with 37 additions and 25 deletions
|
|
@ -363,7 +363,11 @@ in
|
||||||
inherit visible;
|
inherit visible;
|
||||||
type = types.attrsOf (
|
type = types.attrsOf (
|
||||||
types.submodule (
|
types.submodule (
|
||||||
{ config, name, ... }:
|
{
|
||||||
|
config,
|
||||||
|
name,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
profilePath = modulePath ++ [
|
profilePath = modulePath ++ [
|
||||||
"profiles"
|
"profiles"
|
||||||
|
|
@ -889,7 +893,10 @@ in
|
||||||
]
|
]
|
||||||
) config.extensions.packages)
|
) config.extensions.packages)
|
||||||
++ (builtins.concatMap (
|
++ (builtins.concatMap (
|
||||||
{ name, value }:
|
{
|
||||||
|
name,
|
||||||
|
value,
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
packages = builtins.filter (pkg: (pkg.addonId or pkg.name) == name) config.extensions.packages;
|
packages = builtins.filter (pkg: (pkg.addonId or pkg.name) == name) config.extensions.packages;
|
||||||
in
|
in
|
||||||
|
|
@ -990,7 +997,6 @@ in
|
||||||
'';
|
'';
|
||||||
targets.darwin.defaults = (
|
targets.darwin.defaults = (
|
||||||
mkIf (cfg.darwinDefaultsId != null && isDarwin) {
|
mkIf (cfg.darwinDefaultsId != null && isDarwin) {
|
||||||
|
|
||||||
${cfg.darwinDefaultsId} = {
|
${cfg.darwinDefaultsId} = {
|
||||||
EnterprisePoliciesEnabled = true;
|
EnterprisePoliciesEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1055,19 +1061,6 @@ in
|
||||||
force = profile.search.force;
|
force = profile.search.force;
|
||||||
source = profile.search.file;
|
source = profile.search.file;
|
||||||
};
|
};
|
||||||
|
|
||||||
"${cfg.profilesPath}/${profile.path}/extensions" = mkIf (profile.extensions.packages != [ ]) {
|
|
||||||
source =
|
|
||||||
let
|
|
||||||
extensionsEnvPkg = pkgs.buildEnv {
|
|
||||||
name = "hm-firefox-extensions";
|
|
||||||
paths = profile.extensions.packages;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
"${extensionsEnvPkg}/share/mozilla/${extensionPath}";
|
|
||||||
recursive = true;
|
|
||||||
force = true;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(mkMerge (
|
(mkMerge (
|
||||||
|
|
@ -1093,15 +1086,34 @@ in
|
||||||
NoDefaultBookmarks = lib.mkIf (builtins.any (profile: profile.bookmarks.enable) (
|
NoDefaultBookmarks = lib.mkIf (builtins.any (profile: profile.bookmarks.enable) (
|
||||||
builtins.attrValues cfg.profiles
|
builtins.attrValues cfg.profiles
|
||||||
)) false;
|
)) false;
|
||||||
ExtensionSettings = lib.mkIf (cfg.languagePacks != [ ]) (
|
ExtensionSettings = mkMerge (
|
||||||
lib.listToAttrs (
|
[
|
||||||
map (
|
(lib.mkIf (cfg.languagePacks != [ ]) (
|
||||||
lang:
|
lib.listToAttrs (
|
||||||
lib.nameValuePair "langpack-${lang}@firefox.mozilla.org" {
|
map (
|
||||||
installation_mode = "normal_installed";
|
lang:
|
||||||
install_url = "https://releases.mozilla.org/pub/firefox/releases/${cfg.release}/linux-x86_64/xpi/${lang}.xpi";
|
lib.nameValuePair "langpack-${lang}@firefox.mozilla.org" {
|
||||||
}
|
installation_mode = "normal_installed";
|
||||||
) cfg.languagePacks
|
install_url = "https://releases.mozilla.org/pub/firefox/releases/${cfg.release}/linux-x86_64/xpi/${lang}.xpi";
|
||||||
|
}
|
||||||
|
) cfg.languagePacks
|
||||||
|
)
|
||||||
|
))
|
||||||
|
]
|
||||||
|
++ lib.flip mapAttrsToList cfg.profiles (
|
||||||
|
_: profile:
|
||||||
|
lib.listToAttrs (
|
||||||
|
map (
|
||||||
|
pkg:
|
||||||
|
if pkg ? addonId then
|
||||||
|
lib.nameValuePair pkg.addonId {
|
||||||
|
installation_mode = "force_installed";
|
||||||
|
install_url = "file://${pkg.outPath}/share/mozilla/${extensionPath}/${pkg.addonId}.xpi";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ }
|
||||||
|
) profile.extensions.packages
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue