1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 03:30:45 +00:00
nixpkgs/pkgs/tools/networking/i2p/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

123 lines
2.9 KiB
Nix
Raw Normal View History

2023-01-13 02:41:57 +00:00
{ lib
, stdenv
, fetchzip
2023-01-13 02:41:57 +00:00
, jdk
, ant
, gettext
, which
, dbip-country-lite
2023-01-13 02:41:57 +00:00
, java-service-wrapper
, makeWrapper
, gmp
2023-01-13 02:41:57 +00:00
}:
2023-04-09 18:21:00 +01:00
stdenv.mkDerivation (finalAttrs: {
2019-08-28 18:01:35 +01:00
pname = "i2p";
2023-12-20 06:32:56 +00:00
version = "2.4.0";
2019-08-28 18:01:35 +01:00
src = fetchzip {
urls = map (mirror: "${mirror}${finalAttrs.version}/i2psource_${finalAttrs.version}.tar.bz2") [
"https://github.com/i2p/i2p.i2p/releases/download/i2p-"
"https://download.i2p2.de/releases/"
"https://files.i2p-projekt.de/"
"https://download.i2p2.no/releases/"
2023-04-09 18:21:00 +01:00
];
hash = "sha256-RESN1qA/SD9MajUSJyXssNZnph2XZge7xr2kTgOp5V4=";
2015-04-01 14:12:40 +01:00
};
2019-08-28 18:01:35 +01:00
strictDeps = true;
nativeBuildInputs = [
makeWrapper
ant
gettext
jdk
which
];
buildInputs = [ gmp ];
postConfigure = ''
rm -r installer/lib
mkdir -p installer/lib/wrapper/all/
# The java-service-wrapper is needed for build but not really used in runtime
ln -s ${java-service-wrapper}/lib/wrapper.jar installer/lib/wrapper/all/wrapper.jar
# Don't use the bundled geoip data
echo "with-geoip-database=true" >> override.properties
'';
2019-08-28 18:01:35 +01:00
2015-04-01 14:12:40 +01:00
buildPhase = ''
# When this variable exists we can build the .so files only.
export DEBIANVERSION=1
pushd core/c/jcpuid
./build.sh
popd
pushd core/c/jbigi
./build_jbigi.sh dynamic
popd
2015-04-01 14:12:40 +01:00
export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
SOURCE_DATE_EPOCH=0 ant preppkg-unix
2019-08-28 18:01:35 +01:00
'';
2015-04-01 14:12:40 +01:00
installPhase = ''
mkdir -p $out/{bin,share,geoip}
mv pkg-temp/* $out
mv core/c/jbigi/*.so $out/lib
2015-04-01 14:12:40 +01:00
mv $out/man $out/share/
rm $out/{osid,postinstall.sh,INSTALL-headless.txt}
for jar in $out/lib/*.jar; do
if [ ! -z $CP ]; then
CP=$CP:$jar;
else
CP=$jar
fi
done
makeWrapper ${jdk}/bin/java $out/bin/i2prouter \
--add-flags "-cp $CP -Djava.library.path=$out/lib/ -Di2p.dir.base=$out -DloggerFilenameOverride=logs/log-router-@.txt" \
--add-flags "net.i2p.router.RouterLaunch"
ln -s ${dbip-country-lite.mmdb} $out/geoip/GeoLite2-Country.mmdb
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
# Check if jbigi is used
java -cp $out/lib/i2p.jar -Djava.library.path=$out/lib/ net.i2p.util.NativeBigInteger \
| tee /dev/stderr | grep -Fw "Found native library" || exit 1
runHook postInstallCheck
2019-08-28 18:01:35 +01:00
'';
2015-04-01 14:12:40 +01:00
meta = with lib; {
2015-04-01 14:12:40 +01:00
description = "Applications and router for I2P, anonymity over the Internet";
2019-08-28 18:01:35 +01:00
homepage = "https://geti2p.net";
sourceProvenance = with sourceTypes; [
fromSource
2023-01-13 02:41:57 +00:00
binaryBytecode # source bundles dependencies as jars
];
2023-07-07 14:51:14 +01:00
license = with licenses; [
asl20
boost
bsd2
bsd3
cc-by-30
cc0
epl10
gpl2
gpl3
lgpl21Only
lgpl3Only
mit
publicDomain
];
2024-01-12 14:17:56 +00:00
platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
2020-07-12 21:48:18 +01:00
maintainers = with maintainers; [ joelmo ];
2024-02-11 02:19:15 +00:00
mainProgram = "i2prouter-plain";
2015-04-01 14:12:40 +01:00
};
2023-04-09 18:21:00 +01:00
})