nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonOlder
5
6# runtime
7, editables
8, importlib-metadata # < 3.8
9, packaging
10, pathspec
11, pluggy
12, tomli
13
14# tests
15, build
16, python
17, requests
18, toml
19, virtualenv
20}:
21
22let
23 pname = "hatchling";
24 version = "0.25.0";
25in
26buildPythonPackage {
27 inherit pname version;
28 format = "pyproject";
29
30 src = fetchPypi {
31 inherit pname version;
32 hash = "sha256-k/bjZvGaOjZshVr6w3Jb7XaC1dAOlIaraFQKCth2ZII=";
33 };
34
35 # listed in backend/src/hatchling/ouroboros.py
36 propagatedBuildInputs = [
37 editables
38 packaging
39 pathspec
40 pluggy
41 tomli
42 ] ++ lib.optionals (pythonOlder "3.8") [
43 importlib-metadata
44 ];
45
46 pythonImportsCheck = [
47 "hatchling"
48 "hatchling.build"
49 ];
50
51 # tries to fetch packages from the internet
52 doCheck = false;
53
54 # listed in /backend/tests/downstream/requirements.txt
55 checkInputs = [
56 build
57 packaging
58 requests
59 toml
60 virtualenv
61 ];
62
63 preCheck = ''
64 export HOME=$TMPDIR
65 '';
66
67 checkPhase = ''
68 runHook preCheck
69 ${python.interpreter} tests/downstream/integrate.py
70 runHook postCheck
71 '';
72
73 meta = with lib; {
74 description = "Modern, extensible Python build backend";
75 homepage = "https://ofek.dev/hatch/latest/";
76 license = licenses.mit;
77 maintainers = with maintainers; [ hexa ofek ];
78 };
79}