nixpkgs/pkgs/by-name/i2/i2p/package.nix

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

124 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 17:21:00 +00:00
stdenv.mkDerivation (finalAttrs: {
2019-08-28 17:01:35 +00:00
pname = "i2p";
2024-07-20 01:25:09 +00:00
version = "2.6.0";
2019-08-28 17:01:35 +00:00
src = fetchzip {
2024-04-11 14:52:25 +00:00
urls = [
"https://github.com/i2p/i2p.i2p/archive/i2p-${finalAttrs.version}.tar.gz"
] ++ (map (mirror: "${mirror}${finalAttrs.version}/i2psource_${finalAttrs.version}.tar.bz2") [
"https://download.i2p2.de/releases/"
"https://files.i2p-projekt.de/"
"https://download.i2p2.no/releases/"
2024-04-11 14:52:25 +00:00
]);
2024-07-20 01:25:09 +00:00
hash = "sha256-9f4L1JRDTT+sBCEI/GIM9q2u1VJuiZi7DI9qgJMftd0=";
2015-04-01 13:12:40 +00:00
};
2019-08-28 17:01:35 +00: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 17:01:35 +00:00
2015-04-01 13:12:40 +00: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 13:12:40 +00:00
export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
SOURCE_DATE_EPOCH=0 ant preppkg-unix
2019-08-28 17:01:35 +00:00
'';
2015-04-01 13:12:40 +00:00
installPhase = ''
mkdir -p $out/{bin,share,geoip}
mv pkg-temp/* $out
mv core/c/jbigi/*.so $out/lib
2015-04-01 13:12:40 +00: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 17:01:35 +00:00
'';
2015-04-01 13:12:40 +00:00
meta = with lib; {
2015-04-01 13:12:40 +00:00
description = "Applications and router for I2P, anonymity over the Internet";
2019-08-28 17:01:35 +00: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 13:51:14 +00: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" ];
2024-04-08 14:00:42 +00:00
maintainers = with maintainers; [ linsui ];
2024-02-11 02:19:15 +00:00
mainProgram = "i2prouter-plain";
2015-04-01 13:12:40 +00:00
};
2023-04-09 17:21:00 +00:00
})