diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index c2c0d56dfee..d5b09027026 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -6382,6 +6382,13 @@ githubId = 449813; name = "Roman Kuznetsov"; }; + kvark = { + name = "Dzmitry Malyshau"; + email = "kvark@fastmail.com"; + matrix = "@kvark:matrix.org"; + github = "kvark"; + githubId = 107301; + }; kwohlfahrt = { email = "kai.wohlfahrt@gmail.com"; github = "kwohlfahrt"; diff --git a/pkgs/applications/misc/moz-phab/default.nix b/pkgs/applications/misc/moz-phab/default.nix new file mode 100644 index 00000000000..886e06a382b --- /dev/null +++ b/pkgs/applications/misc/moz-phab/default.nix @@ -0,0 +1,57 @@ +{ lib +, buildPythonApplication +, fetchPypi +, mercurial +# build inputs +, distro +, glean-sdk +, python-hglib +, sentry-sdk +, setuptools +}: + +buildPythonApplication rec { + pname = "moz-phab"; + version = "0.1.99"; + + src = fetchPypi { + pname = "MozPhab"; + inherit version; + sha256 = "sha256-uKoMMSp5AIvB1qTRYAh7n1+2dDLneFbssfkfTTshfcs="; + }; + + # Relax python-hglib requirement + # https://phabricator.services.mozilla.com/D131618 + postPatch = '' + substituteInPlace setup.py \ + --replace "==" ">=" + ''; + + propagatedBuildInputs = [ + distro + glean-sdk + python-hglib + sentry-sdk + setuptools + ]; + checkInputs = [ + mercurial + ]; + + preCheck = '' + export HOME=$(mktemp -d) + ''; + + meta = with lib; { + description = "Phabricator CLI from Mozilla to support submission of a series of commits"; + longDescription = '' + moz-phab is a custom command-line tool, which communicates to + Phabricator’s API, providing several conveniences, including support for + submitting series of commits. + ''; + homepage = "https://moz-conduit.readthedocs.io/en/latest/phabricator-user.html"; + license = licenses.mpl20; + maintainers = [ maintainers.kvark ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/development/python-modules/glean-parser/default.nix b/pkgs/development/python-modules/glean-parser/default.nix new file mode 100644 index 00000000000..8a774e66075 --- /dev/null +++ b/pkgs/development/python-modules/glean-parser/default.nix @@ -0,0 +1,61 @@ +{ lib +, buildPythonPackage +, fetchPypi +, pytestCheckHook +, pythonOlder +, setuptools-scm +# build inputs +, appdirs +, click +, diskcache +, jinja2 +, jsonschema +, pyyaml +, yamllint +}: + +buildPythonPackage rec { + pname = "glean_parser"; + version = "4.3.1"; + + disabled = pythonOlder "3.6"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-wZSro1pX/50TlSfFMh71JlmXlJlONVutTDFL06tkw+s="; + }; + + postPatch = '' + substituteInPlace setup.py --replace "pytest-runner" "" + ''; + + propagatedBuildInputs = [ + appdirs + click + diskcache + jinja2 + jsonschema + pyyaml + yamllint + ]; + nativeBuildInputs = [ + setuptools-scm + ]; + + checkInputs = [ + pytestCheckHook + ]; + disabledTests = [ + # https://bugzilla.mozilla.org/show_bug.cgi?id=1741668 + "test_validate_ping" + ]; + + pythonImportsCheck = [ "glean_parser" ]; + + meta = with lib; { + description = "Tools for parsing the metadata for Mozilla's glean telemetry SDK"; + homepage = "https://github.com/mozilla/glean_parser"; + license = licenses.mpl20; + maintainers = [ maintainers.kvark ]; + }; +} diff --git a/pkgs/development/python-modules/glean-sdk/default.nix b/pkgs/development/python-modules/glean-sdk/default.nix new file mode 100644 index 00000000000..e729d927cda --- /dev/null +++ b/pkgs/development/python-modules/glean-sdk/default.nix @@ -0,0 +1,53 @@ +{ lib +, buildPythonPackage +, fetchPypi +, rustPlatform +, rustc +, cargo +, setuptools-rust +# build inputs +, cffi +, glean-parser +}: + +buildPythonPackage rec { + pname = "glean-sdk"; + version = "42.2.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-X2p6KQnEB6ZHdCHGFVEoEMiI+0R2vfGqel+jFKTcx74="; + }; + + patches = [ + # Fix the environment for spawned process + # https://github.com/mozilla/glean/pull/1542 + ./fix-spawned-process-environment.patch + ]; + + cargoDeps = rustPlatform.fetchCargoTarball { + inherit src; + name = "${pname}-${version}"; + sha256 = "sha256-/+rKGPYTLovgjTGL2F/pWzlUy1tY207yuJz3Xdhm1hg="; + }; + + nativeBuildInputs = [ + rustc + cargo + setuptools-rust + rustPlatform.cargoSetupHook + ]; + propagatedBuildInputs = [ + cffi + glean-parser + ]; + + pythonImportsCheck = [ "glean" ]; + + meta = with lib; { + description = "Modern cross-platform telemetry client libraries and are a part of the Glean project"; + homepage = "https://mozilla.github.io/glean/book/index.html"; + license = licenses.mpl20; + maintainers = [ maintainers.kvark ]; + }; +} diff --git a/pkgs/development/python-modules/glean-sdk/fix-spawned-process-environment.patch b/pkgs/development/python-modules/glean-sdk/fix-spawned-process-environment.patch new file mode 100644 index 00000000000..f9a7b2723eb --- /dev/null +++ b/pkgs/development/python-modules/glean-sdk/fix-spawned-process-environment.patch @@ -0,0 +1,20 @@ +diff --git a/glean-core/python/glean/_process_dispatcher.py b/glean-core/python/glean/_process_dispatcher.py +index 33a8b12796..a39b54a917 100644 +--- a/glean-core/python/glean/_process_dispatcher.py ++++ b/glean-core/python/glean/_process_dispatcher.py +@@ -120,8 +120,14 @@ def dispatch(cls, func, args) -> Union[_SyncWorkWrapper, subprocess.Popen]: + Path(".coveragerc").absolute() + ) + ++ # Explicitly pass the contents of `sys.path` as `PYTHONPATH` to the ++ # subprocess so that there aren't any module search path ++ # differences. ++ python_path = ":".join(sys.path)[1:] ++ + p = subprocess.Popen( +- [sys.executable, _process_dispatcher_helper.__file__, payload] ++ [sys.executable, _process_dispatcher_helper.__file__, payload], ++ env={"PYTHONPATH": python_path}, + ) + + cls._last_process = p diff --git a/pkgs/development/python-modules/python-hglib/default.nix b/pkgs/development/python-modules/python-hglib/default.nix new file mode 100644 index 00000000000..9d667dcba85 --- /dev/null +++ b/pkgs/development/python-modules/python-hglib/default.nix @@ -0,0 +1,32 @@ +{ lib +, buildPythonPackage +, fetchPypi +, mercurial +, nose +}: + +buildPythonPackage rec { + pname = "python-hglib"; + version = "2.6.2"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-sYvR7VPJDuV9VxTWata7crZOkw1K7KmDCJLAi7KNpgg="; + }; + + checkInputs = [ mercurial nose ]; + + preCheck = '' + export HGTMP=$(mktemp -d) + export HGUSER=test + ''; + + pythonImportsCheck = [ "hglib" ]; + + meta = with lib; { + description = "Library with a fast, convenient interface to Mercurial. It uses Mercurial’s command server for communication with hg."; + homepage = "https://www.mercurial-scm.org/wiki/PythonHglibs"; + license = licenses.mit; + maintainers = [ maintainers.kvark ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 45b63ac420d..b387efd8ff0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7072,6 +7072,8 @@ with pkgs; motion = callPackage ../applications/video/motion { }; + moz-phab = python3Packages.callPackage ../applications/misc/moz-phab { }; + mtail = callPackage ../servers/monitoring/mtail { }; multitail = callPackage ../tools/misc/multitail { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index f9634dbcb45..6002b122081 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3148,6 +3148,10 @@ in { glcontext = callPackage ../development/python-modules/glcontext { }; + glean-parser = callPackage ../development/python-modules/glean-parser { }; + + glean-sdk = callPackage ../development/python-modules/glean-sdk { }; + glfw = callPackage ../development/python-modules/glfw { }; glob2 = callPackage ../development/python-modules/glob2 { }; @@ -7599,6 +7603,8 @@ in { python-gvm = callPackage ../development/python-modules/python-gvm { }; + python-hglib = callPackage ../development/python-modules/python-hglib { }; + python-hosts = callPackage ../development/python-modules/python-hosts { }; python-hpilo = callPackage ../development/python-modules/python-hpilo { };