From abbbc2c216a55eb7b4e704bf8f0dd545cb97d743 Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <hg@lukegb.com>
Date: Sun, 17 May 2020 03:23:54 +0100
Subject: [PATCH] hg-git: add 0.9.0a1 for py3, and use that

---
 nix/pkgs/default.nix     |  1 +
 nix/pkgs/hg-git.nix      | 22 ++++++++++++++++++++++
 ops/nixos/lib/common.nix |  2 +-
 ops/nixos/lib/hgrc       |  1 +
 4 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 nix/pkgs/hg-git.nix

diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix
index 15e2f191e4..defdb9b310 100644
--- a/nix/pkgs/default.nix
+++ b/nix/pkgs/default.nix
@@ -3,4 +3,5 @@ args: {
   plex-pass = import ./plex-pass.nix args;
   secretsync = import ./secretsync args;
   copybara = import ./copybara.nix args;
+  hg-git = import ./hg-git.nix args;
 } // (import ./heptapod-runner.nix args)
diff --git a/nix/pkgs/hg-git.nix b/nix/pkgs/hg-git.nix
new file mode 100644
index 0000000000..2f02a082d9
--- /dev/null
+++ b/nix/pkgs/hg-git.nix
@@ -0,0 +1,22 @@
+{ pkgs, ... }:
+with pkgs;
+with pkgs.python3Packages;
+(buildPythonPackage rec {
+  pname = "hg-git";
+  version = "0.9.0a1";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1lhb813zljki3q10bx3n9d7c075s6ahhak5d3a1m6gaxmy6gzj5y";
+  };
+
+  doCheck = false;
+
+  propagatedBuildInputs = [ dulwich ];
+
+  meta = with stdenv.lib; {
+    description = "Push and pull from a Git server using Mercurial";
+    homepage = "http://hg-git.github.com/";
+    license = licenses.gpl2;
+  };
+})
diff --git a/ops/nixos/lib/common.nix b/ops/nixos/lib/common.nix
index 25340a403a..009f46e74a 100644
--- a/ops/nixos/lib/common.nix
+++ b/ops/nixos/lib/common.nix
@@ -21,7 +21,7 @@ in
   environment.systemPackages = with pkgs; [
     vim rxvt_unicode.terminfo rebuilder
     (mercurial.overridePythonAttrs (origAttrs: {
-      propagatedBuildInputs = origAttrs.propagatedBuildInputs ++ [python3Packages.hg-evolve];
+      propagatedBuildInputs = origAttrs.propagatedBuildInputs ++ [python3Packages.hg-evolve depot.nix.pkgs.hg-git];
     }))
   ];
 
diff --git a/ops/nixos/lib/hgrc b/ops/nixos/lib/hgrc
index 944315961e..def481d0a9 100644
--- a/ops/nixos/lib/hgrc
+++ b/ops/nixos/lib/hgrc
@@ -54,3 +54,4 @@ remotenames =
 amend =
 evolve =
 topic =
+hggit =