Index: flake.lock
===================================================================
--- flake.lock	(nonexistent)
+++ flake.lock	(working copy)
@@ -0,0 +1,27 @@
+{
+  "nodes": {
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1796087880,
+        "narHash": "sha256-P2MPChVGraSc3Lt8RCUpTwu07reSinLxqmVV/rzq2io=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "c555305170f8bdcc9d420912c04cdf3d6d61d08c",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "ref": "nixos-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "nixpkgs": "nixpkgs"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
Index: flake.nix
===================================================================
--- flake.nix	(nonexistent)
+++ flake.nix	(working copy)
@@ -0,0 +1,56 @@
+# This flake.nix file runs an already compiled JOSM .jar file.
+# It was mostly taken from nixpkgs, with alterations to make it
+# use a local jar hence you must run `ant clean dist` first
+# and run this from the JOSM root directory
+
+# nixpkgs: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/jo/josm/package.nix
+
+{
+  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
+
+  outputs =
+    {
+      nixpkgs,
+      ...
+    }:
+    let
+      pkgs = nixpkgs.legacyPackages.x86_64-linux;
+      extraJavaOpts = "-Djosm.restart=true -Djava.net.useSystemProxies=true";
+      baseJavaOpts = toString [
+        "--add-exports=java.base/sun.security.action=ALL-UNNAMED"
+        "--add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED"
+        "--add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED"
+      ];
+
+      # Path to pre-compiled JOSM .jar file
+      jar = ./dist/josm-custom.jar;
+
+    in
+    with pkgs;
+    {
+      packages.x86_64-linux.default = stdenv.mkDerivation {
+        name = "josm";
+        version = "development";
+
+        dontUnpack = true;
+
+        nativeBuildInputs = [ makeWrapper ];
+        buildInputs = [ jre ];
+
+        installPhase = ''
+          # Copy the jar file in to the Nix store
+          install -Dm644 ${jar} $out/share/josm/josm.jar
+
+          # Add libXxf86vm to path because it is needed by at least Kendzi3D plugin
+          # The GTK file chooser needs the gtk3 gsettings schemas
+          makeWrapper ${pkgs.jre}/bin/java $out/bin/josm \
+            --add-flags "${baseJavaOpts} ${extraJavaOpts} -jar $out/share/josm/josm.jar" \
+            --prefix LD_LIBRARY_PATH ":" '${pkgs.libxxf86vm}/lib' \
+            --prefix XDG_DATA_DIRS : "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}" \
+            --prefix _JAVA_AWT_WM_NONREPARENTING : 1 \
+            --prefix _JAVA_OPTIONS " " "-Dawt.useSystemAAFontSettings=gasp"
+        '';
+
+      };
+    };
+}
