From 456fd57a05f6af1d93a3bc1b7ad77ccef57e992e Mon Sep 17 00:00:00 2001
From: Colin Arnott <colin@urandom.co.uk>
Date: Tue, 1 Nov 2022 10:36:43 +0000
Subject: [PATCH] json-plot: init at 1.1.12

Fixes #85479
---
 .../graphics/json-plot/default.nix            | 27 +++++++++++++++++++
 pkgs/top-level/all-packages.nix               |  2 ++
 2 files changed, 29 insertions(+)
 create mode 100644 pkgs/applications/graphics/json-plot/default.nix

diff --git a/pkgs/applications/graphics/json-plot/default.nix b/pkgs/applications/graphics/json-plot/default.nix
new file mode 100644
index 000000000000..9b43518a87d2
--- /dev/null
+++ b/pkgs/applications/graphics/json-plot/default.nix
@@ -0,0 +1,27 @@
+{ lib
+, fetchFromGitHub
+, buildGoPackage
+}:
+# upstream is pretty stale, but it still works, so until they merge module
+# support we have to use gopath: see sgreben/jp#29
+buildGoPackage rec {
+  pname = "json-plot";
+  version = "1.1.12";
+
+  src = fetchFromGitHub {
+    owner = "sgreben";
+    repo = "jp";
+    rev = version;
+    hash = "sha256-WWARAh/CF3lGli3VLRzAGaCA8xQyryPi8WcuwvdInjk=";
+  };
+
+  goPackagePath = "github.com/sgreben/jp";
+
+  meta = with lib; {
+    description = "Dead simple terminal plots from JSON (or CSV) data. Bar charts, line charts, scatter plots, histograms and heatmaps are supported.";
+    homepage = "https://github.com/sgreben/jp";
+    license = licenses.mit;
+    maintainers = with maintainers; [ urandom ];
+    mainProgram = "jp";
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index d08b09c37e3d..645fa0336365 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -27277,6 +27277,8 @@ with pkgs;
 
   join-desktop = callPackage ../applications/misc/join-desktop { };
 
+  json-plot = callPackage ../applications/graphics/json-plot {};
+
   libbitcoin = callPackage ../tools/misc/libbitcoin/libbitcoin.nix {
     boost = boost175; # fatal error: 'boost/interprocess/detail/posix_time_types_wrk.hpp' file not found
   };