Advertisement
Guest User

Untitled

a guest
Nov 16th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. { stdenv, fetchurl, config, wrapGAppsHook
  2. , alsaLib
  3. , atk
  4. , cairo
  5. , curl
  6. , cups
  7. , dbus_glib
  8. , dbus_libs
  9. , fontconfig
  10. , freetype
  11. , gdk_pixbuf
  12. , glib
  13. , gconf
  14. , glibc
  15. , gst-plugins-base
  16. , gstreamer
  17. , gtk2
  18. , gtk3
  19. , kerberos
  20. , libX11
  21. , libXScrnSaver
  22. , libxcb
  23. , libXcomposite
  24. , libXdamage
  25. , libXext
  26. , libXfixes
  27. , libXinerama
  28. , libXrender
  29. , libXt
  30. , libcanberra_gtk2
  31. , libgnome
  32. , libgnomeui
  33. , defaultIconTheme
  34. , mesa
  35. , nspr
  36. , nss
  37. , pango
  38. , libheimdal
  39. , libpulseaudio
  40. , systemd
  41. , channel
  42. , generated
  43. , writeScript
  44. , xidel
  45. , coreutils
  46. , gnused
  47. , gnugrep
  48. , gnupg
  49. }:
  50.  
  51. assert stdenv.isLinux;
  52.  
  53. let
  54.  
  55. inherit (generated) version sources;
  56.  
  57. mozillaPlatforms = {
  58. "i686-linux" = "linux-i686";
  59. "x86_64-linux" = "linux-x86_64";
  60. };
  61.  
  62. arch = mozillaPlatforms.${stdenv.system};
  63.  
  64. isPrefixOf = prefix: string:
  65. builtins.substring 0 (builtins.stringLength prefix) string == prefix;
  66.  
  67. sourceMatches = locale: source:
  68. (isPrefixOf source.locale locale) && source.arch == arch;
  69.  
  70. systemLocale = config.i18n.defaultLocale or "en-US";
  71.  
  72. defaultSource = stdenv.lib.findFirst (sourceMatches "en-US") {} sources;
  73.  
  74. source = stdenv.lib.findFirst (sourceMatches systemLocale) defaultSource sources;
  75.  
  76. name = "firefox-${channel}-bin-unwrapped-${version}";
  77.  
  78. in
  79.  
  80. stdenv.mkDerivation {
  81. inherit name;
  82.  
  83. src = ./firefox-57.0.tar.bz2;
  84.  
  85. phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
  86.  
  87. libPath = stdenv.lib.makeLibraryPath
  88. [ stdenv.cc.cc
  89. alsaLib
  90. alsaLib.dev
  91. atk
  92. cairo
  93. curl
  94. cups
  95. dbus_glib
  96. dbus_libs
  97. fontconfig
  98. freetype
  99. gconf
  100. gdk_pixbuf
  101. glib
  102. glibc
  103. gst-plugins-base
  104. gstreamer
  105. gtk2
  106. gtk3
  107. kerberos
  108. libX11
  109. libXScrnSaver
  110. libXcomposite
  111. libxcb
  112. libXdamage
  113. libXext
  114. libXfixes
  115. libXinerama
  116. libXrender
  117. libXt
  118. libcanberra_gtk2
  119. libgnome
  120. libgnomeui
  121. mesa
  122. nspr
  123. nss
  124. pango
  125. libheimdal
  126. libpulseaudio
  127. libpulseaudio.dev
  128. systemd
  129. ] + ":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" [
  130. stdenv.cc.cc
  131. ];
  132.  
  133. inherit gtk3;
  134.  
  135. buildInputs = [ wrapGAppsHook gtk3 defaultIconTheme ];
  136.  
  137. # "strip" after "patchelf" may break binaries.
  138. # See: https://github.com/NixOS/patchelf/issues/10
  139. dontStrip = true;
  140. dontPatchELF = true;
  141.  
  142. patchPhase = ''
  143. sed -i -e '/^pref("app.update.channel",/d' defaults/pref/channel-prefs.js
  144. echo 'pref("app.update.channel", "non-existing-channel")' >> defaults/pref/channel-prefs.js
  145. '';
  146.  
  147. installPhase =
  148. ''
  149. mkdir -p "$prefix/usr/lib/firefox-bin-${version}"
  150. cp -r * "$prefix/usr/lib/firefox-bin-${version}"
  151. mkdir -p "$out/bin"
  152. ln -s "$prefix/usr/lib/firefox-bin-${version}/firefox" "$out/bin/"
  153. for executable in \
  154. firefox firefox-bin plugin-container \
  155. updater crashreporter webapprt-stub
  156. do
  157. if [ -e "$out/usr/lib/firefox-bin-${version}/$executable" ]; then
  158. patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
  159. "$out/usr/lib/firefox-bin-${version}/$executable"
  160. fi
  161. done
  162. find . -executable -type f -exec \
  163. patchelf --set-rpath "$libPath" \
  164. "$out/usr/lib/firefox-bin-${version}/{}" \;
  165. # wrapFirefox expects "$out/lib" instead of "$out/usr/lib"
  166. ln -s "$out/usr/lib" "$out/lib"
  167. gappsWrapperArgs+=(--argv0 "$out/bin/.firefox-wrapped")
  168. '';
  169.  
  170. passthru.ffmpegSupport = true;
  171. passthru.gssSupport = true;
  172. passthru.updateScript = import ./update.nix {
  173. inherit name channel writeScript xidel coreutils gnused gnugrep gnupg curl;
  174. baseUrl =
  175. if channel == "devedition"
  176. then "http://archive.mozilla.org/pub/devedition/releases/"
  177. else "http://archive.mozilla.org/pub/firefox/releases/";
  178. };
  179. meta = with stdenv.lib; {
  180. description = "Mozilla Firefox, free web browser (binary package)";
  181. homepage = http://www.mozilla.org/firefox/;
  182. license = {
  183. free = false;
  184. url = http://www.mozilla.org/en-US/foundation/trademarks/policy/;
  185. };
  186. platforms = builtins.attrNames mozillaPlatforms;
  187. maintainers = with maintainers; [ garbas ];
  188. };
  189. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement