From d6b6e4fa6b68205a1508ed4f55690e7b77809451 Mon Sep 17 00:00:00 2001
From: Jonas Heinrich <onny@project-insanity.org>
Date: Fri, 5 Aug 2022 11:42:33 +0200
Subject: [PATCH] hatch: init at 1.3.1

---
 pkgs/development/tools/hatch/default.nix | 69 ++++++++++++++++++++++++
 pkgs/top-level/all-packages.nix          |  2 +
 2 files changed, 71 insertions(+)
 create mode 100644 pkgs/development/tools/hatch/default.nix

diff --git a/pkgs/development/tools/hatch/default.nix b/pkgs/development/tools/hatch/default.nix
new file mode 100644
index 000000000000..777028a008f9
--- /dev/null
+++ b/pkgs/development/tools/hatch/default.nix
@@ -0,0 +1,69 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, python3
+, git
+}:
+
+python3.pkgs.buildPythonApplication rec {
+  pname = "hatch";
+  version = "1.3.1";
+  format = "pyproject";
+
+  src = fetchFromGitHub {
+    owner = "pypa";
+    repo = "hatch";
+    rev = "hatch-v${version}";
+    sha256 = "sha256-ftT86HX5CVbiHe5yzXT2gNl8Rx+f+fmiAJRnOuDpvYI=";
+  };
+
+  propagatedBuildInputs = with python3.pkgs; [
+    click
+    hatchling
+    httpx
+    keyring
+    pexpect
+    pyperclip
+    rich
+    shellingham
+    tomli-w
+    tomlkit
+    userpath
+    virtualenv
+  ];
+
+  checkInputs = with python3.pkgs; [
+    git
+    pytestCheckHook
+    pytest-mock
+  ];
+
+  preCheck = ''
+    export HOME=$(mktemp -d);
+  '';
+
+  disabledTests = [
+    # AssertionError: assert (1980, 1, 2, 0, 0, 0) == (2020, 2, 2, 0, 0, 0)
+    "test_default"
+    "test_explicit_path"
+    "test_default_auto_detection"
+    "test_editable_default"
+    "test_editable_default_extra_dependencies"
+    "test_editable_default_force_include"
+    "test_editable_default_force_include_option"
+    "test_editable_exact"
+    "test_editable_exact_extra_dependencies"
+    "test_editable_exact_force_include"
+    "test_editable_exact_force_include_build_data_precedence"
+    "test_editable_pth"
+    # AssertionError: assert len(extract_installed_requirements(output.splitlines())) > 0
+    "test_creation_allow_system_packages"
+  ];
+
+  meta = with lib; {
+    description = "Modern, extensible Python project manager";
+    homepage = "https://hatch.pypa.io/latest/";
+    license = licenses.mit;
+    maintainers = with maintainers; [ onny ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 593e6a4504da..bd334d914e16 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -7171,6 +7171,8 @@ with pkgs;
 
   haste-server = callPackage ../servers/haste-server { };
 
+  hatch = python3Packages.callPackage ../development/tools/hatch { };
+
   hal-hardware-analyzer = libsForQt5.callPackage ../applications/science/electronics/hal-hardware-analyzer { };
 
   half = callPackage ../development/libraries/half { };