From e0b9154e58ede9becc73f1c3a8886125f11eeecc Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 3 May 2022 19:34:20 +0100 Subject: [PATCH 1/6] python3Packages.hy: 1.0a3 -> 1.0a4 --- pkgs/development/python-modules/hy/default.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/hy/default.nix b/pkgs/development/python-modules/hy/default.nix index 63625bd7ee6..b05233f4a63 100644 --- a/pkgs/development/python-modules/hy/default.nix +++ b/pkgs/development/python-modules/hy/default.nix @@ -11,21 +11,22 @@ 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="; }; propagatedBuildInputs = [ colorama funcparserlib - rply + rply # TODO: remove on the next release ] ++ lib.optionals (pythonOlder "3.9") [ astor ]; @@ -47,6 +48,6 @@ buildPythonPackage rec { description = "Python to/from Lisp layer"; homepage = "https://github.com/hylang/hy"; license = licenses.mit; - maintainers = with maintainers; [ fab ]; + maintainers = with maintainers; [ fab thiagokokada ]; }; } From 72fd5b71bc8d0591b6afb7aab227940f3c670548 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 3 May 2022 20:01:54 +0100 Subject: [PATCH 2/6] 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 { }; From 927dffd2a7ec609c19f02c865a108e4dd5ee1830 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 3 May 2022 20:17:47 +0100 Subject: [PATCH 3/6] python3Packages.hy: fix version --- pkgs/development/python-modules/hy/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/development/python-modules/hy/default.nix b/pkgs/development/python-modules/hy/default.nix index e5b7b9fd578..e37923afad3 100644 --- a/pkgs/development/python-modules/hy/default.nix +++ b/pkgs/development/python-modules/hy/default.nix @@ -4,10 +4,12 @@ , colorama , fetchFromGitHub , funcparserlib +, hy , pytestCheckHook , python , pythonOlder , rply +, testers , hyDefinedPythonPackages ? python-packages: [] /* Packages like with python.withPackages */ }: @@ -25,6 +27,9 @@ buildPythonPackage rec { sha256 = "sha256-MBzp3jqBg/kH233wcgYYHc+Yg9GuOaBsXIfjFDihD1E="; }; + # https://github.com/hylang/hy/blob/1.0a4/get_version.py#L9-L10 + HY_VERSION = version; + propagatedBuildInputs = [ colorama funcparserlib @@ -50,6 +55,11 @@ buildPythonPackage rec { pythonImportsCheck = [ "hy" ]; + passthru.tests.version = testers.testVersion { + package = hy; + command = "hy -v"; + }; + meta = with lib; { description = "Python to/from Lisp layer"; homepage = "https://github.com/hylang/hy"; From d956922c41d333efb67dd07d3b64b311a5eb7b2c Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 3 May 2022 21:55:21 +0100 Subject: [PATCH 4/6] python3Packages.hy: add passthru.withPackages attribute --- pkgs/development/python-modules/hy/default.nix | 15 +++++++++++---- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/hy/default.nix b/pkgs/development/python-modules/hy/default.nix index e37923afad3..cb6fc48aa6d 100644 --- a/pkgs/development/python-modules/hy/default.nix +++ b/pkgs/development/python-modules/hy/default.nix @@ -10,7 +10,8 @@ , pythonOlder , rply , testers -, hyDefinedPythonPackages ? python-packages: [] /* Packages like with python.withPackages */ +, toPythonApplication +, hyDefinedPythonPackages ? python-packages: [ ] /* Packages like with python.withPackages */ }: buildPythonPackage rec { @@ -55,9 +56,15 @@ buildPythonPackage rec { pythonImportsCheck = [ "hy" ]; - passthru.tests.version = testers.testVersion { - package = hy; - command = "hy -v"; + 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; { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 763b563b405..88aac1bbaab 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 = with python3Packages; toPythonApplication hy; + hy = python3Packages.hy.withPackages (python-packages: [ ]); wmic-bin = callPackage ../servers/monitoring/plugins/wmic-bin.nix { }; From 2862810dfaa0a717fcf1924cad819cb186e689bd Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Wed, 4 May 2022 11:42:37 +0100 Subject: [PATCH 5/6] python3Packages.hy: update meta --- pkgs/development/python-modules/hy/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/hy/default.nix b/pkgs/development/python-modules/hy/default.nix index cb6fc48aa6d..a962f86854f 100644 --- a/pkgs/development/python-modules/hy/default.nix +++ b/pkgs/development/python-modules/hy/default.nix @@ -68,8 +68,9 @@ buildPythonPackage rec { }; 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 mazurel nixy thiagokokada ]; }; From 821027934e64a96ac530811172e8c09e7d335f58 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Wed, 4 May 2022 12:42:06 +0100 Subject: [PATCH 6/6] hylure: init at 0.1 --- .../python-modules/hyrule/default.nix | 43 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 45 insertions(+) create mode 100644 pkgs/development/python-modules/hyrule/default.nix 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/python-packages.nix b/pkgs/top-level/python-packages.nix index 894e7f1da5d..66e889bf63a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3998,6 +3998,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; };