generated from nix-community/nur-packages-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mwdumper.nix
70 lines (58 loc) · 1.66 KB
/
mwdumper.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# TODO pin jdk version? current: jdk.version = 19.0.2+7
# the build can break with future versions of jdk
{ stdenv
, lib
, fetchFromGitHub
, jdk
, mvn2nix
, maven
, makeWrapper
}:
let
mavenRepository =
mvn2nix.buildMavenRepositoryFromLockFile { file = ./mvn2nix-lock.json; };
in
stdenv.mkDerivation rec {
pname = "mwdumper";
version = "1.25";
name = "${pname}-${version}";
src = fetchFromGitHub {
owner = "wikimedia";
repo = "mediawiki-tools-mwdumper";
rev = "09fe6ae20de9ee99e8acfff3f1c32a793997367b";
sha256 = "sha256-I5sXLWBchQoaIFh5Bc0GlWSs9ShJOAMa70zgw6k/aVA=";
};
patches = [
./0001-add-maven-resources-plugin-3.3.0.patch
./0002-update-source-and-target-version.patch
./0003-update-all-dependencies.patch
];
nativeBuildInputs = [
jdk
maven
makeWrapper
];
buildPhase = ''
echo "Building with maven repository ${mavenRepository}"
mvn package --offline -Dmaven.repo.local=${mavenRepository}
'';
installPhase = ''
mkdir -p $out/bin
ln -s ${mavenRepository} $out/lib
cp target/${name}.jar $out/
makeWrapper ${jdk}/bin/java $out/bin/${pname} \
--add-flags "-jar $out/${name}.jar"
mkdir -p $out/share/doc
cp README $out/share/doc/${pname}.txt
cp ${./docs/mwdumper.html} $out/share/doc/${pname}.html
mkdir -p $out/share/man/man1
cp ${./docs/mwdumper.man} $out/share/man/man1/${pname}.1
'';
meta = with lib; {
homepage = "https://github.com/wikimedia/mediawiki-tools-mwdumper";
description = "tool for extracting sets of pages from a MediaWiki dump file";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ ];
};
}