diff --git a/pkgs/development/interpreters/hy/builder.nix b/pkgs/development/interpreters/hy/builder.nix deleted file mode 100644 index 6757f859ac1..00000000000 --- a/pkgs/development/interpreters/hy/builder.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ lib -, python3Packages -, hyDefinedPythonPackages /* Packages like with python.withPackages */ -, ... -}: -python3Packages.buildPythonApplication rec { - pname = "hy"; - version = "1.0a1"; - - src = python3Packages.fetchPypi { - inherit pname version; - sha256 = "sha256-lCrbvbkeutSNmvvn/eHpTnJwPb5aEH7hWTXYSE+AJmU="; - }; - - checkInputs = with python3Packages; [ flake8 pytest ]; - - propagatedBuildInputs = with python3Packages; [ - appdirs - astor - clint - colorama - fastentrypoints - funcparserlib - rply - pygments - ] ++ (hyDefinedPythonPackages python3Packages); - - # Hy does not include tests in the source distribution from PyPI, so only test executable. - checkPhase = '' - $out/bin/hy --help > /dev/null - ''; - - meta = with lib; { - description = "A LISP dialect embedded in Python"; - homepage = "https://hylang.org/"; - license = licenses.mit; - maintainers = with maintainers; [ nixy mazurel ]; - platforms = platforms.all; - }; -} diff --git a/pkgs/development/interpreters/hy/default.nix b/pkgs/development/interpreters/hy/default.nix deleted file mode 100644 index f5d80c11d71..00000000000 --- a/pkgs/development/interpreters/hy/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ lib -, callPackage -, hyDefinedPythonPackages ? python-packages: [] /* Packages like with python.withPackages */ -}: -let - withPackages = ( - python-packages: callPackage ./builder.nix { - hyDefinedPythonPackages = python-packages; - } - ); -in -(withPackages hyDefinedPythonPackages) // { - # Export withPackages function for hy customization - inherit withPackages; -} diff --git a/pkgs/development/python-modules/hy/default.nix b/pkgs/development/python-modules/hy/default.nix index 63625bd7ee6..a962f86854f 100644 --- a/pkgs/development/python-modules/hy/default.nix +++ b/pkgs/development/python-modules/hy/default.nix @@ -4,31 +4,44 @@ , colorama , fetchFromGitHub , funcparserlib +, hy , pytestCheckHook +, python , pythonOlder , rply +, testers +, toPythonApplication +, hyDefinedPythonPackages ? python-packages: [ ] /* Packages like with python.withPackages */ }: buildPythonPackage rec { pname = "hy"; - version = "1.0a3"; + version = "1.0a4"; + format = "setuptools"; - disabled = pythonOlder "3.6"; + disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "hylang"; repo = pname; rev = version; - sha256 = "1dqw24rvsps2nab1pbjjm1c81vrs34r4kkk691h3xdyxnv9hb84b"; + sha256 = "sha256-MBzp3jqBg/kH233wcgYYHc+Yg9GuOaBsXIfjFDihD1E="; }; + # https://github.com/hylang/hy/blob/1.0a4/get_version.py#L9-L10 + HY_VERSION = version; + propagatedBuildInputs = [ colorama funcparserlib - rply - ] ++ lib.optionals (pythonOlder "3.9") [ + rply # TODO: remove on the next release + ] + ++ lib.optionals (pythonOlder "3.9") [ astor - ]; + ] + # for backwards compatibility with removed pkgs/development/interpreters/hy + # See: https://github.com/NixOS/nixpkgs/issues/171428 + ++ (hyDefinedPythonPackages python.pkgs); checkInputs = [ pytestCheckHook @@ -43,10 +56,22 @@ buildPythonPackage rec { pythonImportsCheck = [ "hy" ]; + passthru = { + tests.version = testers.testVersion { + package = hy; + command = "hy -v"; + }; + # also for backwards compatibility with removed pkgs/development/interpreters/hy + withPackages = python-packages: (toPythonApplication hy).override { + hyDefinedPythonPackages = python-packages; + }; + }; + meta = with lib; { - description = "Python to/from Lisp layer"; - homepage = "https://github.com/hylang/hy"; + description = "A LISP dialect embedded in Python"; + homepage = "https://hylang.org/"; + changelog = "https://github.com/hylang/hy/releases/tag/${version}"; license = licenses.mit; - maintainers = with maintainers; [ fab ]; + maintainers = with maintainers; [ fab mazurel nixy thiagokokada ]; }; } diff --git a/pkgs/development/python-modules/hyrule/default.nix b/pkgs/development/python-modules/hyrule/default.nix new file mode 100644 index 00000000000..46ed096486b --- /dev/null +++ b/pkgs/development/python-modules/hyrule/default.nix @@ -0,0 +1,43 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, hy +, pytestCheckHook +, pythonOlder +}: + +buildPythonPackage rec { + pname = "hyrule"; + version = "0.1"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "hylang"; + repo = pname; + rev = version; + sha256 = "sha256-sqS5vOcbln+Vfv/Ji/8rJ4GTQpXIuhgf+MukjV0Kkuw="; + }; + + propagatedBuildInputs = [ + hy + ]; + + checkInputs = [ + pytestCheckHook + ]; + + # Some tests depends on hy on PATH + preCheck = "PATH=${hy}/bin:$PATH"; + + pythonImportsCheck = [ "hyrule" ]; + + meta = with lib; { + description = "Hyrule is a utility library for the Hy programming language"; + homepage = "https://github.com/hylang/hyrule"; + changelog = "https://github.com/hylang/hylure/releases/tag/${version}"; + license = licenses.mit; + maintainers = with maintainers; [ thiagokokada ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7521d132290..c89dea3449c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -35058,7 +35058,7 @@ with pkgs; simplenote = callPackage ../applications/misc/simplenote { }; - hy = callPackage ../development/interpreters/hy {}; + hy = python3Packages.hy.withPackages (python-packages: [ ]); wmic-bin = callPackage ../servers/monitoring/plugins/wmic-bin.nix { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ba279cd37da..a6963c11358 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4002,6 +4002,8 @@ in { hyppo = callPackage ../development/python-modules/hyppo { }; + hyrule = callPackage ../development/python-modules/hyrule { }; + i2c-tools = callPackage ../development/python-modules/i2c-tools { inherit (pkgs) i2c-tools; };