From 2651602c17c199fd70a7ef1b68f00b07fdef7fa9 Mon Sep 17 00:00:00 2001 From: Joachim Fasting Date: Wed, 27 Sep 2017 07:10:42 +0200 Subject: [PATCH] tor-browser-bundle: factor out extensions --- .../browsers/tor-browser-bundle/default.nix | 137 +----------------- .../tor-browser-bundle/extensions.nix | 122 ++++++++++++++++ 2 files changed, 125 insertions(+), 134 deletions(-) create mode 100644 pkgs/applications/networking/browsers/tor-browser-bundle/extensions.nix diff --git a/pkgs/applications/networking/browsers/tor-browser-bundle/default.nix b/pkgs/applications/networking/browsers/tor-browser-bundle/default.nix index ca20125332aa..7896270b604a 100644 --- a/pkgs/applications/networking/browsers/tor-browser-bundle/default.nix +++ b/pkgs/applications/networking/browsers/tor-browser-bundle/default.nix @@ -15,7 +15,6 @@ , noto-fonts-emoji # Extensions, common -, unzip , zip # HTTPS Everywhere @@ -36,139 +35,9 @@ let sha256 = "0j37mqldj33fnzghxifvy6v8vdwkcz0i4z81prww64md5s8qcsa9"; }; - # Each extension drv produces an output comprising an unpacked .xpi - # named after the extension uuid, as it would appear under - # `firefox/extensions'. - firefoxExtensions = { - https-everywhere = stdenv.mkDerivation rec { - name = "https-everywhere-${version}"; - version = "5.2.21"; - - extid = "https-everywhere-eff@eff.org"; - - src = fetchgit { - url = "https://git.torproject.org/https-everywhere.git"; - rev = "refs/tags/${version}"; - sha256 = "0z9madihh4b4z4blvfmh6w1hsv8afyi0x7b243nciq9r4w55xgfa"; - }; - - nativeBuildInputs = [ - git - libxml2 # xmllint - python27 - python27Packages.lxml - rsync - unzip - zip - ]; - - unpackPhase = '' - cp -dR --no-preserve=mode "$src" src - cd src - ''; - - # Beware: the build expects translations/ to be non-empty (which it - # will be with submodules initialized). - buildPhase = '' - $shell ./makexpi.sh ${version} --no-recurse - ''; - - installPhase = '' - mkdir $out - unzip -d "$out/$extid" "pkg/https-everywhere-$version-eff.xpi" - ''; - - meta = { - homepage = https://gitweb.torproject.org/https-everywhere.git/; - }; - }; - - noscript = stdenv.mkDerivation rec { - name = "noscript-${version}"; - version = "5.0.10"; - - extid = "{73a6fe31-595d-460b-a920-fcc0f8843232}"; - - src = fetchurl { - url = "https://secure.informaction.com/download/releases/noscript-${version}.xpi"; - sha256 = "18k5karbaj5mhd9cyjbqgik6044bw88rjalkh6anjanxbn503j6g"; - }; - - nativeBuildInputs = [ unzip ]; - - unpackPhase = ":"; - - installPhase = '' - mkdir $out - unzip -d "$out/$extid" "$src" - ''; - }; - - torbutton = stdenv.mkDerivation rec { - name = "torbutton-${version}"; - version = "1.9.8.1"; - - extid = "torbutton@torproject.org"; - - src = fetchgit { - url = "https://git.torproject.org/torbutton.git"; - rev = "refs/tags/${version}"; - sha256 = "1amp0c9ky0a7fsa0bcbi6n6ginw7s2g3an4rj7kvc1lxmrcsm65l"; - }; - - nativeBuildInputs = [ unzip zip ]; - - unpackPhase = '' - cp -dR --no-preserve=mode "$src" src - cd src - ''; - - buildPhase = '' - $shell ./makexpi.sh - ''; - - installPhase = '' - mkdir $out - unzip -d "$out/$extid" "pkg/torbutton-$version.xpi" - ''; - - meta = { - homepage = https://gitweb.torproject.org/torbutton.git/; - }; - }; - - tor-launcher = stdenv.mkDerivation rec { - name = "tor-launcher-${version}"; - version = "0.2.12.3"; - - extid = "tor-launcher@torproject.org"; - - src = fetchgit { - url = "https://git.torproject.org/tor-launcher.git"; - rev = "refs/tags/${version}"; - sha256 = "0126x48pjiy2zm4l8jzhk70w24hviaz560ffp4lb9x0ar615bc9q"; - }; - - nativeBuildInputs = [ unzip zip ]; - - unpackPhase = '' - cp -dR --no-preserve=mode "$src" src - cd src - ''; - - buildPhase = '' - make package - ''; - - installPhase = '' - mkdir $out - unzip -d "$out/$extid" "pkg/tor-launcher-$version.xpi" - ''; - - meta = { - homepage = https://gitweb.torproject.org/tor-launcher.git/; - }; - }; + firefoxExtensions = import ./extensions.nix { + inherit stdenv fetchurl fetchgit zip + git libxml2 python27 python27Packages rsync; }; extensionsEnv = symlinkJoin { diff --git a/pkgs/applications/networking/browsers/tor-browser-bundle/extensions.nix b/pkgs/applications/networking/browsers/tor-browser-bundle/extensions.nix new file mode 100644 index 000000000000..4adf99365ba3 --- /dev/null +++ b/pkgs/applications/networking/browsers/tor-browser-bundle/extensions.nix @@ -0,0 +1,122 @@ +{ stdenv +, fetchgit +, fetchurl + +# common +, zip + +# HTTPS Everywhere +, git +, libxml2 # xmllint +, python27 +, python27Packages +, rsync +}: + +{ + https-everywhere = stdenv.mkDerivation rec { + name = "https-everywhere-${version}"; + version = "5.2.21"; + + extid = "https-everywhere-eff@eff.org"; + + src = fetchgit { + url = "https://git.torproject.org/https-everywhere.git"; + rev = "refs/tags/${version}"; + sha256 = "0z9madihh4b4z4blvfmh6w1hsv8afyi0x7b243nciq9r4w55xgfa"; + }; + + nativeBuildInputs = [ + git + libxml2 # xmllint + python27 + python27Packages.lxml + rsync + zip + ]; + + unpackPhase = '' + cp -dR --no-preserve=mode "$src" src && cd src + ''; + + buildPhase = '' + $shell ./makexpi.sh ${version} --no-recurse + ''; + + installPhase = '' + install -m 444 -D pkg/https-everywhere-$version-eff.xpi "$out/$extid.xpi" + ''; + }; + + noscript = stdenv.mkDerivation rec { + name = "noscript-${version}"; + version = "5.0.10"; + + extid = "{73a6fe31-595d-460b-a920-fcc0f8843232}"; + + src = fetchurl { + url = "https://secure.informaction.com/download/releases/noscript-${version}.xpi"; + sha256 = "18k5karbaj5mhd9cyjbqgik6044bw88rjalkh6anjanxbn503j6g"; + }; + + unpackPhase = ":"; + + installPhase = '' + install -m 444 -D $src "$out/$extid.xpi" + ''; + }; + + torbutton = stdenv.mkDerivation rec { + name = "torbutton-${version}"; + version = "1.9.8.1"; + + extid = "torbutton@torproject.org"; + + src = fetchgit { + url = "https://git.torproject.org/torbutton.git"; + rev = "refs/tags/${version}"; + sha256 = "1amp0c9ky0a7fsa0bcbi6n6ginw7s2g3an4rj7kvc1lxmrcsm65l"; + }; + + nativeBuildInputs = [ zip ]; + + unpackPhase = '' + cp -dR --no-preserve=mode "$src" src && cd src + ''; + + buildPhase = '' + $shell ./makexpi.sh + ''; + + installPhase = '' + install -m 444 -D pkg/torbutton-$version.xpi "$out/$extid.xpi" + ''; + }; + + tor-launcher = stdenv.mkDerivation rec { + name = "tor-launcher-${version}"; + version = "0.2.12.3"; + + extid = "tor-launcher@torproject.org"; + + src = fetchgit { + url = "https://git.torproject.org/tor-launcher.git"; + rev = "refs/tags/${version}"; + sha256 = "0126x48pjiy2zm4l8jzhk70w24hviaz560ffp4lb9x0ar615bc9q"; + }; + + nativeBuildInputs = [ zip ]; + + unpackPhase = '' + cp -dR --no-preserve=mode "$src" src && cd src + ''; + + buildPhase = '' + make package + ''; + + installPhase = '' + install -m 444 -D pkg/tor-launcher-$version.xpi "$out/$extid.xpi" + ''; + }; +}