Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv 2, runCommand, fetchurl, zlib 3 4, version 5}: 6 7assert stdenv.hostPlatform.libc == "glibc"; 8 9let 10 fetchboot = version: arch: sha256: fetchurl { 11 name = "openjdk${version}-bootstrap-${arch}-linux.tar.xz"; 12 url = "http://tarballs.nixos.org/openjdk/2018-03-31/${version}/${arch}-linux.tar.xz"; 13 inherit sha256; 14 }; 15 16 src = if stdenv.hostPlatform.system == "x86_64-linux" then 17 (if version == "10" then fetchboot "10" "x86_64" "08085fsxc1qhqiv3yi38w8lrg3vm7s0m2yvnwr1c92v019806yq2" 18 else if version == "8" then fetchboot "8" "x86_64" "18zqx6jhm3lizn9hh6ryyqc9dz3i96pwaz8f6nxfllk70qi5gvks" 19 else throw "No bootstrap jdk for version ${version}") 20 else if stdenv.hostPlatform.system == "i686-linux" then 21 (if version == "10" then fetchboot "10" "i686" "1blb9gyzp8gfyggxvggqgpcgfcyi00ndnnskipwgdm031qva94p7" 22 else if version == "8" then fetchboot "8" "i686" "1yx04xh8bqz7amg12d13rw5vwa008rav59mxjw1b9s6ynkvfgqq9" 23 else throw "No bootstrap for version") 24 else throw "No bootstrap jdk for system ${stdenv.hostPlatform.system}"; 25 26 bootstrap = runCommand "openjdk-bootstrap" { 27 passthru.home = "${bootstrap}/lib/openjdk"; 28 } '' 29 tar xvf ${src} 30 mv openjdk-bootstrap $out 31 32 LIBDIRS="$(find $out -name \*.so\* -exec dirname {} \; | sort | uniq | tr '\n' ':')" 33 34 find "$out" -type f -print0 | while IFS= read -r -d "" elf; do 35 isELF "$elf" || continue 36 patchelf --set-interpreter $(cat "${stdenv.cc}/nix-support/dynamic-linker") "$elf" || true 37 patchelf --set-rpath "${stdenv.cc.libc}/lib:${stdenv.cc.cc.lib}/lib:${zlib}/lib:$LIBDIRS" "$elf" || true 38 done 39 ''; 40in bootstrap