Merge pull request #266109 from linsui/i2p
This commit is contained in:
commit
5c26e13e2a
@ -5,7 +5,8 @@ with lib;
|
||||
let
|
||||
cfg = config.services.i2p;
|
||||
homeDir = "/var/lib/i2p";
|
||||
in {
|
||||
in
|
||||
{
|
||||
###### interface
|
||||
options.services.i2p.enable = mkEnableOption (lib.mdDoc "I2P router");
|
||||
|
||||
@ -27,7 +28,7 @@ in {
|
||||
User = "i2p";
|
||||
WorkingDirectory = homeDir;
|
||||
Restart = "on-abort";
|
||||
ExecStart = "${pkgs.i2p}/bin/i2prouter-plain";
|
||||
ExecStart = "${pkgs.i2p}/bin/i2prouter";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
122
pkgs/by-name/i2/i2p/package.nix
Normal file
122
pkgs/by-name/i2/i2p/package.nix
Normal file
@ -0,0 +1,122 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchzip
|
||||
, jdk
|
||||
, ant
|
||||
, gettext
|
||||
, which
|
||||
, dbip-country-lite
|
||||
, java-service-wrapper
|
||||
, makeWrapper
|
||||
, gmp
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "i2p";
|
||||
version = "2.4.0";
|
||||
|
||||
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/"
|
||||
];
|
||||
hash = "sha256-RESN1qA/SD9MajUSJyXssNZnph2XZge7xr2kTgOp5V4=";
|
||||
};
|
||||
|
||||
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
|
||||
'';
|
||||
|
||||
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
|
||||
export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
|
||||
SOURCE_DATE_EPOCH=0 ant preppkg-unix
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/{bin,share,geoip}
|
||||
mv pkg-temp/* $out
|
||||
mv core/c/jbigi/*.so $out/lib
|
||||
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
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Applications and router for I2P, anonymity over the Internet";
|
||||
homepage = "https://geti2p.net";
|
||||
sourceProvenance = with sourceTypes; [
|
||||
fromSource
|
||||
binaryBytecode # source bundles dependencies as jars
|
||||
];
|
||||
license = with licenses; [
|
||||
asl20
|
||||
boost
|
||||
bsd2
|
||||
bsd3
|
||||
cc-by-30
|
||||
cc0
|
||||
epl10
|
||||
gpl2
|
||||
gpl3
|
||||
lgpl21Only
|
||||
lgpl3Only
|
||||
mit
|
||||
publicDomain
|
||||
];
|
||||
platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
|
||||
maintainers = with maintainers; [ linsui ];
|
||||
mainProgram = "i2prouter-plain";
|
||||
};
|
||||
})
|
@ -1,86 +0,0 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, ps
|
||||
, coreutils
|
||||
, fetchurl
|
||||
, jdk
|
||||
, jre
|
||||
, ant
|
||||
, gettext
|
||||
, which
|
||||
, java-service-wrapper
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "i2p";
|
||||
version = "2.4.0";
|
||||
|
||||
src = fetchurl {
|
||||
urls = 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"
|
||||
];
|
||||
sha256 = "sha256-MO+K/K0P/6/ZTTCsMH+GtaazGOLB9EoCMAWEGh/NB3w=";
|
||||
};
|
||||
|
||||
buildInputs = [ jdk ant gettext which ];
|
||||
patches = [ ./i2p.patch ];
|
||||
|
||||
buildPhase = ''
|
||||
export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
|
||||
ant preppkg-linux-only
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
set -B
|
||||
mkdir -p $out/{bin,share}
|
||||
cp -r pkg-temp/* $out
|
||||
|
||||
cp ${java-service-wrapper}/bin/wrapper $out/i2psvc
|
||||
cp ${java-service-wrapper}/lib/wrapper.jar $out/lib
|
||||
cp ${java-service-wrapper}/lib/libwrapper.so $out/lib
|
||||
|
||||
sed -i $out/i2prouter -i $out/runplain.sh \
|
||||
-e "s#uname#${coreutils}/bin/uname#" \
|
||||
-e "s#which#${which}/bin/which#" \
|
||||
-e "s#%gettext%#${gettext}/bin/gettext#" \
|
||||
-e "s#/usr/ucb/ps#${ps}/bin/ps#" \
|
||||
-e "s#/usr/bin/tr#${coreutils}/bin/tr#" \
|
||||
-e "s#%INSTALL_PATH#$out#" \
|
||||
-e 's#%USER_HOME#$HOME#' \
|
||||
-e "s#%SYSTEM_java_io_tmpdir#/tmp#" \
|
||||
-e "s#%JAVA%#${jre}/bin/java#"
|
||||
mv $out/runplain.sh $out/bin/i2prouter-plain
|
||||
mv $out/man $out/share/
|
||||
chmod +x $out/bin/* $out/i2psvc
|
||||
rm $out/{osid,postinstall.sh,INSTALL-headless.txt}
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Applications and router for I2P, anonymity over the Internet";
|
||||
homepage = "https://geti2p.net";
|
||||
sourceProvenance = with sourceTypes; [
|
||||
fromSource
|
||||
binaryBytecode # source bundles dependencies as jars
|
||||
];
|
||||
license = with licenses; [
|
||||
asl20
|
||||
boost
|
||||
bsd2
|
||||
bsd3
|
||||
cc-by-30
|
||||
cc0
|
||||
epl10
|
||||
gpl2
|
||||
gpl3
|
||||
lgpl21Only
|
||||
lgpl3Only
|
||||
mit
|
||||
publicDomain
|
||||
];
|
||||
platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
|
||||
maintainers = with maintainers; [ joelmo ];
|
||||
mainProgram = "i2prouter-plain";
|
||||
};
|
||||
})
|
@ -1,43 +0,0 @@
|
||||
diff --git a/installer/resources/i2prouter b/installer/resources/i2prouter
|
||||
index 365737d89..2ea14db3e 100644
|
||||
--- a/installer/resources/i2prouter
|
||||
+++ b/installer/resources/i2prouter
|
||||
@@ -49,7 +49,7 @@ APP_LONG_NAME="I2P Service"
|
||||
|
||||
# gettext - we look for it in the path
|
||||
# fallback to echo is below, we can't set it to echo here.
|
||||
-GETTEXT=$(which gettext > /dev/null 2>&1)
|
||||
+GETTEXT=%gettext%
|
||||
|
||||
# Where to install the systemd service
|
||||
SYSTEMD_SERVICE="/etc/systemd/system/${APP_NAME}.service"
|
||||
diff --git a/installer/resources/runplain.sh b/installer/resources/runplain.sh
|
||||
index eb4995dfe..0186cede3 100644
|
||||
--- a/installer/resources/runplain.sh
|
||||
+++ b/installer/resources/runplain.sh
|
||||
@@ -25,7 +25,7 @@ CP=
|
||||
|
||||
# Try using the Java binary that I2P was installed with.
|
||||
# If it's not found, try looking in the system PATH.
|
||||
-JAVA=$(which "%JAVA_HOME"/bin/java || which java)
|
||||
+JAVA=%JAVA%
|
||||
|
||||
if [ -z $JAVA ] || [ ! -x $JAVA ]; then
|
||||
echo "Error: Cannot find java." >&2
|
||||
@@ -44,15 +44,4 @@ if [ $(uname -s) = "Darwin" ]; then
|
||||
export JAVA_TOOL_OPTIONS="-Djava.awt.headless=true"
|
||||
fi
|
||||
JAVAOPTS="${MAXMEMOPT} -Djava.net.preferIPv4Stack=${PREFERv4} -Djava.library.path=${I2P}:${I2P}/lib -Di2p.dir.base=${I2P} -DloggerFilenameOverride=logs/log-router-@.txt"
|
||||
-(
|
||||
- nohup ${JAVA} -cp \"${CP}\" ${JAVAOPTS} net.i2p.router.RouterLaunch > /dev/null 2>&1
|
||||
-) &
|
||||
-PID=$!
|
||||
-
|
||||
-if [ ! -z $PID ] && kill -0 $PID > /dev/null 2>&1 ; then
|
||||
- echo "I2P started [$PID]" >&2
|
||||
- echo $PID > "${I2PTEMP}/router.pid"
|
||||
-else
|
||||
- echo "I2P failed to start." >&2
|
||||
- exit 1
|
||||
-fi
|
||||
+exec ${JAVA} -cp \"${CP}\" ${JAVAOPTS} net.i2p.router.RouterLaunch
|
@ -9183,8 +9183,6 @@ with pkgs;
|
||||
|
||||
i2c-tools = callPackage ../os-specific/linux/i2c-tools { };
|
||||
|
||||
i2p = callPackage ../tools/networking/i2p { };
|
||||
|
||||
i2pd = callPackage ../tools/networking/i2pd { };
|
||||
|
||||
iannix = libsForQt5.callPackage ../applications/audio/iannix { };
|
||||
|
Loading…
Reference in New Issue
Block a user