mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
chromium: address plasma integration review
Hide the Plasma integration options on non-Linux platforms so the Chromium module does not need fallback access for platform-specific options. Switch the integration package option to mkPackageOption and document the kdePackages default path with pkgsText. Also tighten the focused NMT test so Darwin does not set the Linux-only option while still asserting that no native host file is produced there.
This commit is contained in:
@@ -74,27 +74,26 @@ let
|
||||
'';
|
||||
};
|
||||
}
|
||||
// lib.optionalAttrs (lib.elem browser plasmaSupportedBrowsers) {
|
||||
plasmaSupport = mkOption {
|
||||
inherit visible;
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether to enable the 'Use QT' theme for ${name} on Linux.";
|
||||
};
|
||||
//
|
||||
lib.optionalAttrs (pkgs.stdenv.hostPlatform.isLinux && lib.elem browser plasmaSupportedBrowsers)
|
||||
{
|
||||
plasmaSupport = mkOption {
|
||||
inherit visible;
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether to enable the 'Use QT' theme for ${name} on Linux.";
|
||||
};
|
||||
|
||||
plasmaBrowserIntegrationPackage = mkOption {
|
||||
inherit visible;
|
||||
type = types.package;
|
||||
default = pkgs.kdePackages.plasma-browser-integration;
|
||||
defaultText = literalExpression "pkgs.kdePackages.plasma-browser-integration";
|
||||
example = literalExpression "pkgs.kdePackages.plasma-browser-integration";
|
||||
description = ''
|
||||
Package to use for the Plasma browser integration native messaging
|
||||
host on Linux.
|
||||
'';
|
||||
};
|
||||
}
|
||||
plasmaBrowserIntegrationPackage =
|
||||
lib.mkPackageOption pkgs.kdePackages "plasma-browser-integration" {
|
||||
extraDescription = "Used for the native messaging host on Linux.";
|
||||
pkgsText = "pkgs.kdePackages";
|
||||
}
|
||||
// {
|
||||
inherit visible;
|
||||
};
|
||||
}
|
||||
// {
|
||||
dictionaries = mkOption {
|
||||
inherit visible;
|
||||
@@ -269,7 +268,8 @@ let
|
||||
value.source = pkg;
|
||||
};
|
||||
|
||||
plasmaSupportEnabled = pkgs.stdenv.isLinux && (cfg.plasmaSupport or false);
|
||||
plasmaSupportEnabled =
|
||||
pkgs.stdenv.isLinux && lib.elem browser plasmaSupportedBrowsers && cfg.plasmaSupport;
|
||||
|
||||
nativeMessagingHosts = lib.unique (
|
||||
cfg.nativeMessagingHosts ++ lib.optional plasmaSupportEnabled cfg.plasmaBrowserIntegrationPackage
|
||||
|
||||
@@ -48,6 +48,18 @@ let
|
||||
"Library/Application Support/Google/Chrome/NativeMessagingHosts"
|
||||
else
|
||||
".config/google-chrome/NativeMessagingHosts";
|
||||
|
||||
nativeHostAssertion =
|
||||
if pkgs.stdenv.hostPlatform.isLinux then
|
||||
''
|
||||
assertFileExists \
|
||||
"home-files/${nativeHostsDir}/org.kde.plasma.browser_integration.json"
|
||||
''
|
||||
else
|
||||
''
|
||||
assertPathNotExists \
|
||||
"home-files/${nativeHostsDir}/org.kde.plasma.browser_integration.json"
|
||||
'';
|
||||
in
|
||||
{
|
||||
programs.google-chrome = {
|
||||
@@ -57,6 +69,8 @@ in
|
||||
"--enable-logging=stderr"
|
||||
"--ignore-gpu-blocklist"
|
||||
];
|
||||
}
|
||||
// lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||
plasmaSupport = true;
|
||||
inherit plasmaBrowserIntegrationPackage;
|
||||
};
|
||||
@@ -76,17 +90,6 @@ in
|
||||
plasmaSupport=${lib.boolToString pkgs.stdenv.hostPlatform.isLinux}
|
||||
''}
|
||||
|
||||
${
|
||||
if pkgs.stdenv.hostPlatform.isLinux then
|
||||
''
|
||||
assertFileExists \
|
||||
"home-files/${nativeHostsDir}/org.kde.plasma.browser_integration.json"
|
||||
''
|
||||
else
|
||||
''
|
||||
assertPathNotExists \
|
||||
"home-files/${nativeHostsDir}/org.kde.plasma.browser_integration.json"
|
||||
''
|
||||
}
|
||||
${nativeHostAssertion}
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user