nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, fetchurl, fetchsvn, makeWrapper, unzip, jre, libXxf86vm
2, extraJavaOpts ? "-Djosm.restart=true -Djava.net.useSystemProxies=true"
3}:
4let
5 pname = "josm";
6 version = "18721";
7 srcs = {
8 jar = fetchurl {
9 url = "https://josm.openstreetmap.de/download/josm-snapshot-${version}.jar";
10 hash = "sha256-nc6itoblAzP064xTTF8q990TiRX3+zf5uk+enS+C5Jo=";
11 };
12 macosx = fetchurl {
13 url = "https://josm.openstreetmap.de/download/macosx/josm-macos-${version}-java17.zip";
14 hash = "sha256-uaj32PupxAS5Pa7us9sIeeepGJ6BIljm41e6onB7zxQ=";
15 };
16 pkg = fetchsvn {
17 url = "https://josm.openstreetmap.de/svn/trunk/native/linux/tested";
18 rev = version;
19 sha256 = "sha256-/zdOaiyuvSwdVZcnw0ghDj2I+YKpFLc12fjZUMtRtVg=";
20 };
21 };
22in
23stdenv.mkDerivation rec {
24 inherit pname version;
25
26 dontUnpack = true;
27
28 nativeBuildInputs = [ makeWrapper ];
29 buildInputs = lib.optionals (!stdenv.isDarwin) [ jre ];
30
31 installPhase =
32 if stdenv.isDarwin then ''
33 mkdir -p $out/Applications
34 ${unzip}/bin/unzip ${srcs.macosx} 'JOSM.app/*' -d $out/Applications
35 '' else ''
36 install -Dm644 ${srcs.jar} $out/share/josm/josm.jar
37 cp -R ${srcs.pkg}/usr/share $out
38
39 # Add libXxf86vm to path because it is needed by at least Kendzi3D plugin
40 makeWrapper ${jre}/bin/java $out/bin/josm \
41 --add-flags "${extraJavaOpts} -jar $out/share/josm/josm.jar" \
42 --prefix LD_LIBRARY_PATH ":" '${libXxf86vm}/lib'
43 '';
44
45 meta = with lib; {
46 description = "An extensible editor for OpenStreetMap";
47 homepage = "https://josm.openstreetmap.de/";
48 changelog = "https://josm.openstreetmap.de/wiki/Changelog";
49 sourceProvenance = with sourceTypes; [ binaryBytecode ];
50 license = licenses.gpl2Plus;
51 maintainers = with maintainers; [ rycee sikmir ];
52 platforms = platforms.all;
53 };
54}