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