1 { lib, stdenv, fetchurl, fetchFromGitHub, makeWrapper, unzip, jre, libXxf86vm
2 , extraJavaOpts ? "-Djosm.restart=true -Djava.net.useSystemProxies=true"
9 url = "https://josm.openstreetmap.de/download/josm-snapshot-${version}.jar";
10 hash = "sha256-NXf95ANB5Ezgf1CKEbefrIxoyqHgYC/WKNf7+p3D/pY=";
13 url = "https://josm.openstreetmap.de/download/macosx/josm-macos-${version}-java21.zip";
14 hash = "sha256-vP7s6kneOOpLUYZ1Un7Zdo8wMZ/fErLaJFxtR/vCvD8=";
16 pkg = fetchFromGitHub {
19 tag = "${version}-tested";
20 hash = "sha256-3aVMZFYz7J8fkCR4TVmkvsAu2cX7swxiNt12is42nKE=";
24 # Needed as of version 19017.
25 baseJavaOpts = toString [
26 "--add-exports=java.base/sun.security.action=ALL-UNNAMED"
27 "--add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED"
28 "--add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED"
31 stdenv.mkDerivation rec {
32 inherit pname version;
36 nativeBuildInputs = [ makeWrapper ];
37 buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [ jre ];
40 if stdenv.hostPlatform.isDarwin then ''
41 mkdir -p $out/Applications
42 ${unzip}/bin/unzip ${srcs.macosx} 'JOSM.app/*' -d $out/Applications
44 install -Dm644 ${srcs.jar} $out/share/josm/josm.jar
45 cp -R ${srcs.pkg}/native/linux/tested/usr/share $out
47 # Add libXxf86vm to path because it is needed by at least Kendzi3D plugin
48 makeWrapper ${jre}/bin/java $out/bin/josm \
49 --add-flags "${baseJavaOpts} ${extraJavaOpts} -jar $out/share/josm/josm.jar" \
50 --prefix LD_LIBRARY_PATH ":" '${libXxf86vm}/lib'
54 description = "Extensible editor for OpenStreetMap";
55 homepage = "https://josm.openstreetmap.de/";
56 changelog = "https://josm.openstreetmap.de/wiki/Changelog";
57 sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
58 license = lib.licenses.gpl2Plus;
59 maintainers = with lib.maintainers; [ rycee sikmir ];
60 platforms = lib.platforms.all;