From 72fd5b71bc8d0591b6afb7aab227940f3c670548 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 3 May 2022 20:01:54 +0100 Subject: [PATCH] hy: replace it with python3Packages.hy Add `hyDefinedPythonPackages` parameter to allow backwards compatibility with interpreters/hy. Fixes https://github.com/NixOS/nixpkgs/issues/171428. --- pkgs/development/interpreters/hy/builder.nix | 40 ------------------- pkgs/development/interpreters/hy/default.nix | 15 ------- .../development/python-modules/hy/default.nix | 12 ++++-- pkgs/top-level/all-packages.nix | 2 +- 4 files changed, 10 insertions(+), 59 deletions(-) delete mode 100644 pkgs/development/interpreters/hy/builder.nix delete mode 100644 pkgs/development/interpreters/hy/default.nix 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 b05233f4a63..e5b7b9fd578 100644 --- a/pkgs/development/python-modules/hy/default.nix +++ b/pkgs/development/python-modules/hy/default.nix @@ -5,8 +5,10 @@ , fetchFromGitHub , funcparserlib , pytestCheckHook +, python , pythonOlder , rply +, hyDefinedPythonPackages ? python-packages: [] /* Packages like with python.withPackages */ }: buildPythonPackage rec { @@ -27,9 +29,13 @@ buildPythonPackage rec { colorama funcparserlib rply # TODO: remove on the next release - ] ++ lib.optionals (pythonOlder "3.9") [ + ] + ++ 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 @@ -48,6 +54,6 @@ buildPythonPackage rec { description = "Python to/from Lisp layer"; homepage = "https://github.com/hylang/hy"; license = licenses.mit; - maintainers = with maintainers; [ fab thiagokokada ]; + maintainers = with maintainers; [ fab mazurel nixy thiagokokada ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9b4b5760373..763b563b405 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -35047,7 +35047,7 @@ with pkgs; simplenote = callPackage ../applications/misc/simplenote { }; - hy = callPackage ../development/interpreters/hy {}; + hy = with python3Packages; toPythonApplication hy; wmic-bin = callPackage ../servers/monitoring/plugins/wmic-bin.nix { };