From 690a845de93a49e85480ad5fae492fa14658ce85 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 25 Nov 2014 13:39:16 +0100 Subject: [PATCH] chromium: Use Nix expressions for plugin settings. We now create Nix expressions within the plugin output path(s) which then will be imported and incorporated into the wrapper. This makes it easier for other plugins to provide configuration settings to the main Chromium wrapper. Of course, in order to allow for external plugins we need to allow passing a list of plugins to the Chromium derivation, but right now we keep it internal and only use it for things such as NaCl (as soon as we support it, of course). Signed-off-by: aszlig --- .../networking/browsers/chromium/default.nix | 9 ++++-- .../networking/browsers/chromium/plugins.nix | 31 ++++++++++++------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index aeb56d88eabe..3e35b704120c 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -69,14 +69,17 @@ in stdenv.mkDerivation { buildCommand = let browserBinary = "${chromium.browser}/libexec/chromium/chromium"; sandboxBinary = "${chromium.sandbox}/bin/chromium-sandbox"; - in '' + mkEnvVar = key: val: "--set '${key}' '${val}'"; + envVars = chromium.plugins.settings.envVars or {}; + flags = chromium.plugins.settings.flags or []; + in with stdenv.lib; '' mkdir -p "$out/bin" "$out/share/applications" ln -s "${chromium.browser}/share" "$out/share" makeWrapper "${browserBinary}" "$out/bin/chromium" \ --set CHROMIUM_SANDBOX_BINARY_PATH "${sandboxBinary}" \ - --run "export ${chromium.plugins.envVarsEnabled}" \ - --add-flags "${chromium.plugins.flagsEnabled}" + ${concatStrings (mapAttrsToList mkEnvVar envVars)} \ + --add-flags "${concatStringsSep " " flags}" ln -s "$out/bin/chromium" "$out/bin/chromium-browser" ln -s "${chromium.browser}/share/icons" "$out/share/icons" diff --git a/pkgs/applications/networking/browsers/chromium/plugins.nix b/pkgs/applications/networking/browsers/chromium/plugins.nix index 8098ec747227..55e0cc4caa21 100644 --- a/pkgs/applications/networking/browsers/chromium/plugins.nix +++ b/pkgs/applications/networking/browsers/chromium/plugins.nix @@ -62,29 +62,38 @@ let install -vD PepperFlash/libpepflashplayer.so \ "$flash/lib/libpepflashplayer.so" mkdir -p "$flash/nix-support" - echo "--ppapi-flash-path='$flash/lib/libpepflashplayer.so'" \ - "--ppapi-flash-version=$flashVersion" \ - > "$flash/nix-support/chromium-flags" + cat > "$flash/nix-support/chromium-plugin.nix" < "$widevine/nix-support/chromium-flags" - echo "NIX_CHROMIUM_PLUGIN_PATH_WIDEVINE=$widevine/lib" \ - > "$widevine/nix-support/chromium-env-vars" + cat > "$widevine/nix-support/chromium-plugin.nix" <