mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
mkFirefoxModule: support extensions without addonID
Properly handle extensions missing addonId without eval error. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
c7f4214fac
commit
5200f3903f
1 changed files with 14 additions and 8 deletions
|
|
@ -830,9 +830,15 @@ in
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
++ (builtins.concatMap (
|
++ (builtins.concatMap (
|
||||||
{ addonId, meta, ... }:
|
{
|
||||||
|
addonId ? null,
|
||||||
|
name,
|
||||||
|
meta,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
permissions = config.extensions.settings.${addonId}.permissions or null;
|
safeAddonId = if addonId != null then addonId else name;
|
||||||
|
permissions = config.extensions.settings.${safeAddonId}.permissions or null;
|
||||||
requireCheck = config.extensions.exhaustivePermissions || permissions != null;
|
requireCheck = config.extensions.exhaustivePermissions || permissions != null;
|
||||||
authorizedPermissions = lib.optionals (permissions != null) permissions;
|
authorizedPermissions = lib.optionals (permissions != null) permissions;
|
||||||
missingPermissions = lib.subtractLists authorizedPermissions meta.mozPermissions;
|
missingPermissions = lib.subtractLists authorizedPermissions meta.mozPermissions;
|
||||||
|
|
@ -847,20 +853,20 @@ in
|
||||||
config.extensions.exactPermissions && missingPermissions != [ ] && redundantPermissions != [ ]
|
config.extensions.exactPermissions && missingPermissions != [ ] && redundantPermissions != [ ]
|
||||||
then
|
then
|
||||||
''
|
''
|
||||||
Extension ${addonId} requests permissions that weren't
|
Extension ${safeAddonId} requests permissions that weren't
|
||||||
authorized: ${builtins.toJSON missingPermissions}.
|
authorized: ${builtins.toJSON missingPermissions}.
|
||||||
Additionally, the following permissions were authorized,
|
Additionally, the following permissions were authorized,
|
||||||
but extension ${addonId} did not request them:
|
but extension ${safeAddonId} did not request them:
|
||||||
${builtins.toJSON redundantPermissions}.
|
${builtins.toJSON redundantPermissions}.
|
||||||
Consider adjusting the permissions in''
|
Consider adjusting the permissions in''
|
||||||
else if config.extensions.exactPermissions && redundantPermissions != [ ] then
|
else if config.extensions.exactPermissions && redundantPermissions != [ ] then
|
||||||
''
|
''
|
||||||
The following permissions were authorized, but extension
|
The following permissions were authorized, but extension
|
||||||
${addonId} did not request them: ${builtins.toJSON redundantPermissions}.
|
${safeAddonId} did not request them: ${builtins.toJSON redundantPermissions}.
|
||||||
Consider removing the redundant permissions from''
|
Consider removing the redundant permissions from''
|
||||||
else
|
else
|
||||||
''
|
''
|
||||||
Extension ${addonId} requests permissions that weren't
|
Extension ${safeAddonId} requests permissions that weren't
|
||||||
authorized: ${builtins.toJSON missingPermissions}.
|
authorized: ${builtins.toJSON missingPermissions}.
|
||||||
Consider adding the missing permissions to'';
|
Consider adding the missing permissions to'';
|
||||||
in
|
in
|
||||||
|
|
@ -874,7 +880,7 @@ in
|
||||||
profilePath
|
profilePath
|
||||||
++ [
|
++ [
|
||||||
"extensions"
|
"extensions"
|
||||||
addonId
|
safeAddonId
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
}.permissions'.
|
}.permissions'.
|
||||||
|
|
@ -885,7 +891,7 @@ in
|
||||||
++ (builtins.concatMap (
|
++ (builtins.concatMap (
|
||||||
{ name, value }:
|
{ name, value }:
|
||||||
let
|
let
|
||||||
packages = builtins.filter (pkg: pkg.addonId == name) config.extensions.packages;
|
packages = builtins.filter (pkg: (pkg.addonId or pkg.name) == name) config.extensions.packages;
|
||||||
in
|
in
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue