Merge pull request #200101 from nagy/freenet

This commit is contained in:
Sandro 2022-11-28 00:15:31 +01:00 committed by GitHub
commit 462f837721
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 49 deletions

View file

@ -9674,6 +9674,15 @@
githubId = 6783654;
name = "Nadrieril Feneanar";
};
nagy = {
email = "danielnagy@posteo.de";
github = "nagy";
githubId = 692274;
name = "Daniel Nagy";
keys = [{
fingerprint = "F6AE 2C60 9196 A1BC ECD8 7108 1B8E 8DCB 576F B671";
}];
};
nalbyuites = {
email = "ashijit007@gmail.com";
github = "nalbyuites";

View file

@ -1,72 +1,64 @@
{ lib, stdenv, fetchurl, fetchFromGitHub, ant, jdk, bash, coreutils, substituteAll }:
{ lib, stdenv, fetchurl, jdk, bash, coreutils, substituteAll }:
let
freenet_ext = fetchurl {
url = "https://downloads.freenetproject.org/latest/freenet-ext.jar";
sha256 = "17ypljdvazgx2z6hhswny1lxfrknysz3x6igx8vl3xgdpvbb7wij";
version = "build01494";
jna = fetchurl {
url = "https://github.com/freenet/fred/releases/download/${version}/jna-4.5.2.jar";
sha256 = "sha256-DI63rPZyYWVteQBRkd66ujtr9d1gpDc1okVCk4Hb7P8=";
};
jna_platform = fetchurl {
url = "https://github.com/freenet/fred/releases/download/${version}/jna-platform-4.5.2.jar";
sha256 = "sha256-8dAMFn2JIcbiPGJu+fHDrgvkc8lcaP+gErx65VqH4tY=";
};
freenet_ext = fetchurl {
url = "https://github.com/freenet/fred/releases/download/${version}/freenet-ext.jar";
sha256 = "sha256-MvKz1r7t9UE36i+aPr72dmbXafCWawjNF/19tZuk158=";
};
bcprov_version = "jdk15on-154";
bcprov = fetchurl {
url = "https://www.bouncycastle.org/download/bcprov-ext-${bcprov_version}.jar";
sha256 = "0abmhg2h44g8c5p7skzqwfxj8xwcjh9vs84mc0hr78k1am0633jk";
url = "https://github.com/freenet/fred/releases/download/${version}/bcprov-jdk15on-1.59.jar";
sha256 = "sha256-HDHkTjMdJeRtKTs+juLQcCimfbAR50yyRDKFrtHVnIU=";
};
seednodes = fetchurl {
url = "https://downloads.freenetproject.org/alpha/opennet/seednodes.fref";
sha256 = "08awwr8n80b4cdzzb3y8hf2fzkr1f2ly4nlq779d6pvi5jymqdvv";
};
version = "build01480";
freenet-jars = stdenv.mkDerivation {
pname = "freenet-jars";
inherit version;
src = fetchFromGitHub {
owner = "freenet";
repo = "fred";
rev = version;
sha256 = "0wddkfyhsgs7bcq9svicz6l0a35yv82yqzmji3c345hg4hbch3kb";
src = fetchurl {
url = "https://github.com/freenet/fred/releases/download/${version}/freenet.jar";
sha256 = "sha256-1Pjc8Ob4EN7N05QkGTMKBn7z3myTDaQ98N48nNSLstg=";
};
patchPhase = ''
cp ${freenet_ext} lib/freenet/freenet-ext.jar
cp ${bcprov} lib/bcprov-${bcprov_version}.jar
sed '/antcall.*-ext/d' -i build.xml
sed 's/@unknown@/${version}/g' -i build-clean.xml
'';
buildInputs = [ ant jdk ];
buildPhase = "ant package-only";
dontUnpack = true;
installPhase = ''
mkdir -p $out/share/freenet
cp lib/bcprov-${bcprov_version}.jar $out/share/freenet
cp lib/freenet/freenet-ext.jar $out/share/freenet
cp dist/freenet.jar $out/share/freenet
ln -s ${bcprov} $out/share/freenet/bcprov.jar
ln -s ${freenet_ext} $out/share/freenet/freenet-ext.jar
ln -s ${jna_platform} $out/share/freenet/jna_platform.jar
ln -s ${jna} $out/share/freenet/jna.jar
ln -s $src $out/share/freenet/freenet.jar
'';
};
in stdenv.mkDerivation {
name = "freenet-${version}";
pname = "freenet";
inherit version;
src = substituteAll {
src = ./freenetWrapper;
inherit bash coreutils seednodes bcprov_version;
inherit bash coreutils jdk seednodes;
freenet = freenet-jars;
jre = jdk.jre;
};
jars = freenet-jars;
dontUnpack = true;
installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/freenet
chmod +x $out/bin/freenet
install -Dm555 $src $out/bin/freenet
ln -s ${freenet-jars}/share $out/share
'';
@ -75,7 +67,7 @@ in stdenv.mkDerivation {
homepage = "https://freenetproject.org/";
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = lib.licenses.gpl2Plus;
maintainers = [ ];
maintainers = with lib.maintainers; [ nagy ];
platforms = with lib.platforms; linux;
};
}

View file

@ -1,18 +1,17 @@
#! @bash@/bin/bash
set -eo pipefail
PATH=@coreutils@/bin:$PATH
export CLASSPATH=@freenet@/share/freenet/bcprov.jar:@freenet@/share/freenet/freenet-ext.jar:@freenet@/share/freenet/jna_platform.jar:@freenet@/share/freenet/jna.jar:@freenet@/share/freenet/freenet.jar
export FREENET_HOME="$HOME/.local/share/freenet"
if [ -n "$XDG_DATA_HOME" ]
then export FREENET_HOME="$XDG_DATA_HOME/freenet"
if [ -n "$XDG_DATA_HOME" ] ; then
FREENET_HOME="$XDG_DATA_HOME/freenet"
fi
if [ ! -d $FREENET_HOME ]; then
mkdir -p $FREENET_HOME
fi
mkdir -p -- $FREENET_HOME
cp -u @seednodes@ $FREENET_HOME/seednodes.fref
chmod u+rw $FREENET_HOME/seednodes.fref
cp -u -- @seednodes@ $FREENET_HOME/seednodes.fref
chmod u+rw -- $FREENET_HOME/seednodes.fref
cd $FREENET_HOME
@jre@/bin/java -cp @freenet@/share/freenet/bcprov-@bcprov_version@.jar:@freenet@/share/freenet/freenet-ext.jar:@freenet@/share/freenet/freenet.jar -Xmx1024M freenet.node.NodeStarter
cd -- $FREENET_HOME
exec @jdk@/bin/java -Xmx1024M freenet.node.NodeStarter "$@"

View file

@ -28840,9 +28840,7 @@ with pkgs;
jre = jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
};
freenet = callPackage ../applications/networking/p2p/freenet {
jdk = jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
};
freenet = callPackage ../applications/networking/p2p/freenet { };
freeoffice = callPackage ../applications/office/softmaker/freeoffice.nix {};