Skip to content

Commit 7395957

Browse files
authored
peergos: 0.22.0 -> 1.0.0, build from source (#384316)
2 parents 6fa3bff + abe9998 commit 7395957

File tree

1 file changed

+70
-22
lines changed

1 file changed

+70
-22
lines changed
Lines changed: 70 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,103 @@
11
{
22
lib,
33
stdenv,
4-
fetchurl,
4+
fetchFromGitHub,
5+
ant,
6+
jdk,
7+
openjdk8-bootstrap,
58
jre,
9+
stripJavaArchivesHook,
610
makeWrapper,
711
nix-update-script,
812
}:
913

14+
let
15+
tweetnacl = stdenv.mkDerivation {
16+
pname = "tweetnacl";
17+
version = "0-unstable-12-02-2020";
18+
19+
src = fetchFromGitHub {
20+
owner = "ianopolous";
21+
repo = "tweetnacl-java";
22+
rev = "6d1bde81ea63051750cda40422b62e478b85d2b0";
23+
hash = "sha256-BDWzDpUBi4UuvxFwA9ton+RtHOzDcWql1ti+cdvhzks=";
24+
};
25+
26+
postPatch = ''
27+
substituteInPlace Makefile \
28+
--replace-fail gcc cc
29+
'';
30+
31+
makeFlags = [ "jni" ];
32+
33+
nativeBuildInputs = [
34+
openjdk8-bootstrap # javah
35+
];
36+
37+
installPhase = ''
38+
install -Dvm644 libtweetnacl.so $out/lib/libtweetnacl.so
39+
'';
40+
};
41+
in
1042
stdenv.mkDerivation rec {
1143
pname = "peergos";
12-
version = "0.22.0";
13-
src = fetchurl {
14-
url = "https://github.com/Peergos/web-ui/releases/download/v${version}/Peergos.jar";
15-
hash = "sha256-JjJBHL2wdAt+V9wAujvBIdAw/OAe89sHsYsv+cXEjTY=";
44+
version = "1.0.0";
45+
src = fetchFromGitHub {
46+
owner = "Peergos";
47+
repo = "web-ui";
48+
rev = "v${version}";
49+
hash = "sha256-TSvhp/9nneXGADiDPgGvA78emVcQG0UzHsFfVS9k7mo=";
50+
fetchSubmodules = true;
1651
};
1752

18-
dontUnpack = true;
19-
dontBuild = true;
53+
nativeBuildInputs = [
54+
ant
55+
jdk
56+
stripJavaArchivesHook
57+
makeWrapper
58+
];
2059

21-
nativeBuildInputs = [ makeWrapper ];
60+
postPatch = ''
61+
substituteInPlace build.xml \
62+
--replace-fail '${"\${repository.version}"}' '${version}'
63+
'';
64+
65+
buildPhase = ''
66+
runHook preBuild
67+
ant dist
68+
runHook postBuild
69+
'';
2270

2371
installPhase = ''
2472
runHook preInstall
2573
26-
install -D ${src} $out/share/java/peergos.jar
74+
install -Dvm644 server/Peergos.jar $out/share/java/peergos.jar
75+
install -Dvm644 ${tweetnacl}/lib/libtweetnacl.so $out/native-lib/libtweetnacl.so
76+
77+
# --chdir as peergos expects to find `libtweetnacl.so` in `native-lib/`
2778
makeWrapper ${lib.getExe jre} $out/bin/peergos \
28-
--add-flags "-jar -Djava.library.path=native-lib $out/share/java/peergos.jar"
79+
--chdir $out \
80+
--add-flags "-Djava.library.path=native-lib -jar $out/share/java/peergos.jar"
2981
3082
runHook postInstall
3183
'';
3284

33-
passthru.updateScript = nix-update-script {
34-
extraArgs = [
35-
"--version-regex"
36-
"^(v[0-9.]+)$"
37-
];
38-
};
85+
passthru.updateScript = nix-update-script { };
3986

4087
meta = {
4188
changelog = "https://github.com/Peergos/web-ui/releases/tag/v${version}";
42-
description = "P2p, secure file storage, social network and application protocol";
89+
description = "P2P, secure file storage, social network and application protocol";
4390
downloadPage = "https://github.com/Peergos/web-ui";
4491
homepage = "https://peergos.org/";
45-
# peergos have agpt3 license, peergos-web-ui have gpl3, both are used
4692
license = [
47-
lib.licenses.agpl3Only
48-
lib.licenses.gpl3Only
93+
lib.licenses.agpl3Only # server
94+
lib.licenses.gpl3Only # web-ui
4995
];
5096
mainProgram = "peergos";
51-
maintainers = with lib.maintainers; [ raspher ];
97+
maintainers = with lib.maintainers; [
98+
raspher
99+
christoph-heiss
100+
];
52101
platforms = lib.platforms.all;
53-
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
54102
};
55103
}

0 commit comments

Comments
 (0)