git.iko.soy/typeable/nixpkgs
on master help sign in
chromium: Allow env vars for passing plugin paths.

Introduces environment variables to set plugin base paths. The schema for these is like NIX_CHROMIUM_PLUGIN_PATH_<N>. Where <N> is the path type we want to change, the supported (full) variable names are: * NIX_CHROMIUM_PLUGIN_PATH_ALL * NIX_CHROMIUM_PLUGIN_PATH_PEPPERFLASH * NIX_CHROMIUM_PLUGIN_PATH_FILEFLASH * NIX_CHROMIUM_PLUGIN_PATH_PDF * NIX_CHROMIUM_PLUGIN_PATH_FILE_EFFECTS * NIX_CHROMIUM_PLUGIN_PATH_NACL * NIX_CHROMIUM_PLUGIN_PATH_PNACL * NIX_CHROMIUM_PLUGIN_PATH_WIDEVINE Whereas NIX_CHROMIUM_PLUGIN_PATH_ALL is the plugin base path for every path which is not set explicitly, so by setting ..._ALL and not setting ..._WIDEVINE, the widevine plugin will be searched in the directory specified using ..._ALL. Right now, the only plugin where this is used is widevine, and it still doesn't properly work yet. Signed-off-by: aszlig <aszlig@redmoonstudios.org>

commit1b84fbf0cacaa3999979602919c3ee8df7ae9c6d authoraszlig <aszlig@redmoonstudios.org> dateThu 20 Nov 2014, 16:46 (12 years ago) parent2495e81
4 files changed+109−3
pkgs/applications/networking/browsers/chromium/default.nix+1 pkgs/applications/networking/browsers/chromium/plugins.nix+8−2 pkgs/applications/networking/browsers/chromium/source/default.nix+1−1 pkgs/applications/networking/browsers/chromium/source/nix_plugin_paths.patch+99
pkgs/applications/networking/browsers/chromium/default.nix+1
@@ -74,6 +74,7 @@ in stdenv.mkDerivation {
7474 ln -s "${chromium.browser}/share" "$out/share"
7575 makeWrapper "${browserBinary}" "$out/bin/chromium" \
7676 --set CHROMIUM_SANDBOX_BINARY_PATH "${sandboxBinary}" \
77+ --run "export ${chromium.plugins.envVarsEnabled}" \
7778 --add-flags "${chromium.plugins.flagsEnabled}"
7879
7980 ln -s "$out/bin/chromium" "$out/bin/chromium-browser"
pkgs/applications/networking/browsers/chromium/plugins.nix+8−2
@@ -88,13 +88,19 @@ let
8888 mkdir -p "$widevine/nix-support"
8989 echo "--register-pepper-plugins='${wvModule}${wvInfo}'" \
9090 > "$widevine/nix-support/chromium-flags"
91+ echo "NIX_CHROMIUM_PLUGIN_PATH_WIDEVINE=$widevine/lib" \
92+ > "$widevine/nix-support/chromium-env-vars"
9193 '';
9294
93− passthru.flagsEnabled = let
95+ passthru = let
9496 enabledPlugins = optional enablePepperFlash plugins.flash
9597 ++ optional enablePepperPDF plugins.pdf
9698 ++ optional enableWideVine plugins.widevine;
9799 getFlags = plugin: "$(< ${plugin}/nix-support/chromium-flags)";
98− in concatStringsSep " " (map getFlags enabledPlugins);
100+ getEnvVars = plugin: "$(< ${plugin}/nix-support/chromium-env-vars)";
101+ in {
102+ flagsEnabled = concatStringsSep " " (map getFlags enabledPlugins);
103+ envVarsEnabled = concatStringsSep " " (map getEnvVars enabledPlugins);
104+ };
99105 };
100106in plugins
pkgs/applications/networking/browsers/chromium/source/default.nix+1−1
@@ -22,7 +22,7 @@ stdenv.mkDerivation {
2222
2323 prePatch = "patchShebangs .";
2424
25− patches = [ ./sandbox_userns_36.patch ];
25+ patches = [ ./sandbox_userns_36.patch ./nix_plugin_paths.patch ];
2626
2727 postPatch = ''
2828 sed -i -r \
pkgs/applications/networking/browsers/chromium/source/nix_plugin_paths.patchnew file+99
@@ -0,0 +1,99 @@
1+diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
2+index 8a205a6..d5c24e1 100644
3+--- a/chrome/common/chrome_paths.cc
4++++ b/chrome/common/chrome_paths.cc
5+@@ -97,21 +97,14 @@ static base::LazyInstance<base::FilePath>
6+ g_invalid_specified_user_data_dir = LAZY_INSTANCE_INITIALIZER;
7+
8+ // Gets the path for internal plugins.
9+-bool GetInternalPluginsDirectory(base::FilePath* result) {
10+-#if defined(OS_MACOSX) && !defined(OS_IOS)
11+- // If called from Chrome, get internal plugins from a subdirectory of the
12+- // framework.
13+- if (base::mac::AmIBundled()) {
14+- *result = chrome::GetFrameworkBundlePath();
15+- DCHECK(!result->empty());
16+- *result = result->Append("Internet Plug-Ins");
17+- return true;
18+- }
19+- // In tests, just look in the module directory (below).
20+-#endif
21+-
22+- // The rest of the world expects plugins in the module directory.
23+- return PathService::Get(base::DIR_MODULE, result);
24++bool GetInternalPluginsDirectory(base::FilePath* result,
25++ const std::string& ident) {
26++ std::string full_env = std::string("NIX_CHROMIUM_PLUGIN_PATH_") + ident;
27++ const char* value = getenv(full_env.c_str());
28++ if (value == NULL)
29++ return PathService::Get(base::DIR_MODULE, result);
30++ else
31++ *result = base::FilePath(value);
32+ }
33+
34+ } // namespace
35+@@ -248,11 +241,11 @@ bool PathProvider(int key, base::FilePath* result) {
36+ create_dir = true;
37+ break;
38+ case chrome::DIR_INTERNAL_PLUGINS:
39+- if (!GetInternalPluginsDirectory(&cur))
40++ if (!GetInternalPluginsDirectory(&cur, "ALL"))
41+ return false;
42+ break;
43+ case chrome::DIR_PEPPER_FLASH_PLUGIN:
44+- if (!GetInternalPluginsDirectory(&cur))
45++ if (!GetInternalPluginsDirectory(&cur, "PEPPERFLASH"))
46+ return false;
47+ cur = cur.Append(kPepperFlashBaseDirectory);
48+ break;
49+@@ -285,7 +278,7 @@ bool PathProvider(int key, base::FilePath* result) {
50+ cur = cur.Append(FILE_PATH_LITERAL("script.log"));
51+ break;
52+ case chrome::FILE_FLASH_PLUGIN:
53+- if (!GetInternalPluginsDirectory(&cur))
54++ if (!GetInternalPluginsDirectory(&cur, "FILEFLASH"))
55+ return false;
56+ cur = cur.Append(kInternalFlashPluginFileName);
57+ break;
58+@@ -295,12 +288,12 @@ bool PathProvider(int key, base::FilePath* result) {
59+ cur = cur.Append(chrome::kPepperFlashPluginFilename);
60+ break;
61+ case chrome::FILE_PDF_PLUGIN:
62+- if (!GetInternalPluginsDirectory(&cur))
63++ if (!GetInternalPluginsDirectory(&cur, "PDF"))
64+ return false;
65+ cur = cur.Append(kInternalPDFPluginFileName);
66+ break;
67+ case chrome::FILE_EFFECTS_PLUGIN:
68+- if (!GetInternalPluginsDirectory(&cur))
69++ if (!GetInternalPluginsDirectory(&cur, "FILE_EFFECTS"))
70+ return false;
71+ cur = cur.Append(kEffectsPluginFileName);
72+ break;
73+@@ -308,7 +301,7 @@ bool PathProvider(int key, base::FilePath* result) {
74+ // We currently need a path here to look up whether the plugin is disabled
75+ // and what its permissions are.
76+ case chrome::FILE_NACL_PLUGIN:
77+- if (!GetInternalPluginsDirectory(&cur))
78++ if (!GetInternalPluginsDirectory(&cur, "NACL"))
79+ return false;
80+ cur = cur.Append(kInternalNaClPluginFileName);
81+ break;
82+@@ -343,7 +336,7 @@ bool PathProvider(int key, base::FilePath* result) {
83+ cur = cur.DirName();
84+ }
85+ #else
86+- if (!GetInternalPluginsDirectory(&cur))
87++ if (!GetInternalPluginsDirectory(&cur, "PNACL"))
88+ return false;
89+ #endif
90+ cur = cur.Append(FILE_PATH_LITERAL("pnacl"));
91+@@ -372,7 +365,7 @@ bool PathProvider(int key, base::FilePath* result) {
92+ // In the component case, this is the source adapter. Otherwise, it is the
93+ // actual Pepper module that gets loaded.
94+ case chrome::FILE_WIDEVINE_CDM_ADAPTER:
95+- if (!GetInternalPluginsDirectory(&cur))
96++ if (!GetInternalPluginsDirectory(&cur, "WIDEVINE"))
97+ return false;
98+ cur = cur.AppendASCII(kWidevineCdmAdapterFileName);
99+ break;