1{
2 lib,
3 astor,
4 buildPythonPackage,
5 fetchFromGitHub,
6 funcparserlib,
7 hy,
8 pytestCheckHook,
9 python,
10 pythonOlder,
11 setuptools,
12 testers,
13}:
14
15buildPythonPackage rec {
16 pname = "hy";
17 version = "0.29.0";
18 pyproject = true;
19
20 disabled = pythonOlder "3.8";
21
22 src = fetchFromGitHub {
23 owner = "hylang";
24 repo = "hy";
25 rev = "refs/tags/${version}";
26 hash = "sha256-8b2V78mwzSThmVl1SfMGBw8VSpE5rCuucnIyD0nq5To=";
27 };
28
29 # https://github.com/hylang/hy/blob/1.0a4/get_version.py#L9-L10
30 HY_VERSION = version;
31
32 build-system = [ setuptools ];
33
34 dependencies = [ funcparserlib ] ++ lib.optionals (pythonOlder "3.9") [ astor ];
35
36 nativeCheckInputs = [ pytestCheckHook ];
37
38 preCheck = ''
39 # For test_bin_hy
40 export PATH="$out/bin:$PATH"
41 '';
42
43 pythonImportsCheck = [ "hy" ];
44
45 passthru = {
46 tests.version = testers.testVersion {
47 package = hy;
48 command = "hy -v";
49 };
50 # For backwards compatibility with removed pkgs/development/interpreters/hy
51 # Example usage:
52 # hy.withPackages (ps: with ps; [ hyrule requests ])
53 withPackages =
54 python-packages:
55 (python.withPackages (ps: (python-packages ps) ++ [ ps.hy ])).overrideAttrs (old: {
56 name = "${hy.name}-env";
57 meta = lib.mergeAttrs (builtins.removeAttrs hy.meta [ "license" ]) { mainProgram = "hy"; };
58 });
59 };
60
61 meta = with lib; {
62 description = "A LISP dialect embedded in Python";
63 homepage = "https://hylang.org/";
64 changelog = "https://github.com/hylang/hy/releases/tag/${version}";
65 license = licenses.mit;
66 maintainers = with maintainers; [
67 mazurel
68 nixy
69 thiagokokada
70 ];
71 };
72}