From 32160d80dc30501dc7460c1d6e54db6b047204b4 Mon Sep 17 00:00:00 2001
From: Evan Stoll <evan.stoll@rjginc.com>
Date: Fri, 13 Nov 2020 22:01:32 -0500
Subject: [PATCH] gping: 1.1 -> 0.1.6

---
 pkgs/tools/networking/gping/default.nix | 29 ++++++++++---------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/pkgs/tools/networking/gping/default.nix b/pkgs/tools/networking/gping/default.nix
index 092f3611abb7..76fdecf5e14c 100644
--- a/pkgs/tools/networking/gping/default.nix
+++ b/pkgs/tools/networking/gping/default.nix
@@ -1,32 +1,25 @@
 { lib
-, iputils
-, python3
-, python3Packages
+, rustPlatform
+, fetchFromGitHub
 }:
 
-python3Packages.buildPythonApplication rec {
+rustPlatform.buildRustPackage rec {
   pname = "gping";
-  version = "1.1";
+  version = "0.1.6";
 
-  propagatedBuildInputs = with python3Packages; [ colorama ];
-
-  src = python3Packages.fetchPypi {
-    inherit version;
-    pname  = "pinggraph";
-    sha256 = "0q5ma98457zb6vxsnhmrr3p38j1vg0gl155y0adzfg67wlniac92";
+  src = fetchFromGitHub {
+    owner = "orf";
+    repo = "gping";
+    rev = "v${version}";
+    sha256 = "1scwwrrj30ff9yr776gpn4jyl3lbrx2s2dv0pc8b1zj7mvwp3as2";
   };
 
-  # Make path to ping explicit
-  postFixup = ''
-    substituteInPlace $out/${python3.sitePackages}/gping/pinger.py \
-      --replace 'subprocess.getoutput("ping ' 'subprocess.getoutput("${iputils}/bin/ping ' \
-      --replace 'args = ["ping"]' 'args = ["${iputils}/bin/ping"]'
-  '';
+  cargoSha256 = "1dsfrl5cajl9nmzl6p43j7j50xn1z7dymqaz8kqs7zalj9zadm8k";
 
   meta = with lib; {
     description = "Ping, but with a graph";
     homepage = "https://github.com/orf/gping";
-    license = licenses.gpl2;
+    license = licenses.mit;
     maintainers = with maintainers; [ andrew-d ];
   };
 }