tmuxPlugins.catppucin: unstable-2024-05-16 -> 2.1.2 (#379030)
[NixPkgs.git] / pkgs / by-name / jo / josm / package.nix
blobb44109aa1df8d8e11d33303d18d05d61ac68126a
1 { lib, stdenv, fetchurl, fetchFromGitHub, makeWrapper, unzip, jre, libXxf86vm
2 , extraJavaOpts ? "-Djosm.restart=true -Djava.net.useSystemProxies=true"
3 }:
4 let
5   pname = "josm";
6   version = "19277";
7   srcs = {
8     jar = fetchurl {
9       url = "https://josm.openstreetmap.de/download/josm-snapshot-${version}.jar";
10       hash = "sha256-NXf95ANB5Ezgf1CKEbefrIxoyqHgYC/WKNf7+p3D/pY=";
11     };
12     macosx = fetchurl {
13       url = "https://josm.openstreetmap.de/download/macosx/josm-macos-${version}-java21.zip";
14       hash = "sha256-vP7s6kneOOpLUYZ1Un7Zdo8wMZ/fErLaJFxtR/vCvD8=";
15     };
16     pkg = fetchFromGitHub {
17       owner = "JOSM";
18       repo = "josm";
19       tag = "${version}-tested";
20       hash = "sha256-3aVMZFYz7J8fkCR4TVmkvsAu2cX7swxiNt12is42nKE=";
21     };
22   };
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"
29   ];
31 stdenv.mkDerivation rec {
32   inherit pname version;
34   dontUnpack = true;
36   nativeBuildInputs = [ makeWrapper ];
37   buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [ jre ];
39   installPhase =
40     if stdenv.hostPlatform.isDarwin then ''
41       mkdir -p $out/Applications
42       ${unzip}/bin/unzip ${srcs.macosx} 'JOSM.app/*' -d $out/Applications
43     '' else ''
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'
51     '';
53   meta = {
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;
61     mainProgram = "josm";
62   };