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