nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 130 lines 3.1 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchzip, 5 jdk, 6 ant, 7 gettext, 8 which, 9 dbip-country-lite, 10 java-service-wrapper, 11 makeWrapper, 12 gmp, 13}: 14 15stdenv.mkDerivation (finalAttrs: { 16 pname = "i2p"; 17 version = "2.9.0"; 18 19 src = fetchzip { 20 urls = [ 21 "https://github.com/i2p/i2p.i2p/archive/i2p-${finalAttrs.version}.tar.gz" 22 ] 23 ++ (map (mirror: "${mirror}${finalAttrs.version}/i2psource_${finalAttrs.version}.tar.bz2") [ 24 "https://download.i2p2.de/releases/" 25 "https://files.i2p-projekt.de/" 26 "https://download.i2p2.no/releases/" 27 ]); 28 hash = "sha256-8gnCjSBcTz8KxNPo9KUnnn2IWfCswA/sGDkqzOjNX34="; 29 }; 30 31 strictDeps = true; 32 33 nativeBuildInputs = [ 34 makeWrapper 35 ant 36 gettext 37 jdk 38 which 39 ]; 40 41 buildInputs = [ gmp ]; 42 43 postConfigure = '' 44 rm -r installer/lib 45 mkdir -p installer/lib/wrapper/all/ 46 # The java-service-wrapper is needed for build but not really used in runtime 47 ln -s ${java-service-wrapper}/lib/wrapper.jar installer/lib/wrapper/all/wrapper.jar 48 # Don't use the bundled geoip data 49 echo "with-geoip-database=true" >> override.properties 50 ''; 51 52 buildPhase = '' 53 # When this variable exists we can build the .so files only. 54 export DEBIANVERSION=1 55 pushd core/c/jcpuid 56 ./build.sh 57 popd 58 pushd core/c/jbigi 59 ./build_jbigi.sh dynamic 60 popd 61 export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" 62 SOURCE_DATE_EPOCH=0 ant preppkg-unix 63 ''; 64 65 installPhase = '' 66 mkdir -p $out/{bin,share,geoip} 67 mv pkg-temp/* $out 68 mv core/c/jbigi/*.so $out/lib 69 mv $out/man $out/share/ 70 rm $out/{osid,postinstall.sh,INSTALL-headless.txt} 71 72 for jar in $out/lib/*.jar; do 73 if [ ! -z $CP ]; then 74 CP=$CP:$jar; 75 else 76 CP=$jar 77 fi 78 done 79 80 makeWrapper ${jdk}/bin/java $out/bin/i2prouter \ 81 --add-flags "-cp $CP -Djava.library.path=$out/lib/ -Di2p.dir.base=$out -DloggerFilenameOverride=logs/log-router-@.txt" \ 82 --add-flags "net.i2p.router.RouterLaunch" 83 84 ln -s ${dbip-country-lite.mmdb} $out/geoip/GeoLite2-Country.mmdb 85 ''; 86 87 doInstallCheck = true; 88 89 installCheckPhase = '' 90 runHook preInstallCheck 91 92 # Check if jbigi is used 93 java -cp $out/lib/i2p.jar -Djava.library.path=$out/lib/ net.i2p.util.NativeBigInteger \ 94 | tee /dev/stderr | grep -Fw "Found native library" || exit 1 95 96 runHook postInstallCheck 97 ''; 98 99 meta = with lib; { 100 description = "Applications and router for I2P, anonymity over the Internet"; 101 homepage = "https://geti2p.net"; 102 changelog = "https://github.com/i2p/i2p.i2p/releases/tag/i2p-${finalAttrs.version}"; 103 sourceProvenance = with sourceTypes; [ 104 fromSource 105 binaryBytecode # source bundles dependencies as jars 106 ]; 107 license = with licenses; [ 108 asl20 109 boost 110 bsd2 111 bsd3 112 cc-by-30 113 cc0 114 epl10 115 gpl2 116 gpl3 117 lgpl21Only 118 lgpl3Only 119 mit 120 publicDomain 121 ]; 122 platforms = [ 123 "x86_64-linux" 124 "i686-linux" 125 "aarch64-linux" 126 ]; 127 maintainers = with maintainers; [ linsui ]; 128 mainProgram = "i2prouter-plain"; 129 }; 130})