diff --git a/pkgs/by-name/me/meshcore-cli/package.nix b/pkgs/by-name/me/meshcore-cli/package.nix new file mode 100644 index 000000000000..e521c4560a48 --- /dev/null +++ b/pkgs/by-name/me/meshcore-cli/package.nix @@ -0,0 +1 @@ +{ python3Packages }: with python3Packages; toPythonApplication meshcore-cli diff --git a/pkgs/development/python-modules/meshcore-cli/default.nix b/pkgs/development/python-modules/meshcore-cli/default.nix new file mode 100644 index 000000000000..e77403ae3317 --- /dev/null +++ b/pkgs/development/python-modules/meshcore-cli/default.nix @@ -0,0 +1,53 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + hatchling, + + # dependencies + bleak, + meshcore, + prompt-toolkit, + requests, +}: + +buildPythonPackage (finalAttrs: { + pname = "meshcore-cli"; + version = "1.5.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "fdlamotte"; + repo = "meshcore-cli"; + tag = "v${finalAttrs.version}"; + hash = "sha256-wby97e9Xulk2pwNJ9mnvKxWlTsWmH4n3zlTtYi7WS6I="; + }; + + build-system = [ hatchling ]; + + dependencies = [ + meshcore + bleak + prompt-toolkit + requests + ]; + + pythonImportsCheck = [ + "meshcore_cli" + ]; + + doCheck = false; # no tests + + __structuredAttrs = true; + + meta = { + changelog = "https://github.com/meshcore-dev/meshcore-cli/releases/tag/${finalAttrs.src.tag}"; + description = "Command line interface to MeshCore node"; + homepage = "https://github.com/fdlamotte/meshcore-cli"; + license = lib.licenses.mit; + maintainers = [ lib.maintainers.haylin ]; + mainProgram = "meshcore-cli"; + }; +}) diff --git a/pkgs/development/python-modules/meshcore/default.nix b/pkgs/development/python-modules/meshcore/default.nix index 9d5a7330b5bb..0858e8f42a4f 100644 --- a/pkgs/development/python-modules/meshcore/default.nix +++ b/pkgs/development/python-modules/meshcore/default.nix @@ -2,31 +2,54 @@ lib, buildPythonPackage, fetchFromGitHub, + fetchpatch, + + # build-system hatchling, + # dependencies bleak, pycayennelpp, pyserial-asyncio-fast, + pycryptodome, + + # tests + pytest-asyncio, + pytestCheckHook, }: buildPythonPackage (finalAttrs: { pname = "meshcore"; - version = "2.2.8"; + version = "2.3.0"; pyproject = true; src = fetchFromGitHub { owner = "meshcore-dev"; repo = "meshcore_py"; tag = "v${finalAttrs.version}"; - hash = "sha256-S3hyA2TsgEHwB0gv5xFMTbwnAoGbceq0C5+8MBedD70="; + hash = "sha256-Vz2LQaP44Yojf9h2rSBvKRjW99IOj7C5MxqQnIUoIRE="; }; + patches = [ + (fetchpatch { + # https://github.com/meshcore-dev/meshcore_py/pull/71 + url = "https://github.com/meshcore-dev/meshcore_py/commit/9294e574739844e0e291b972b40e1a0a40149e47.patch"; + hash = "sha256-Ufr+5rDDO32W6dtD7wEU34iLJai3H0dBCEtLS5j4u/0="; + }) + ]; + build-system = [ hatchling ]; dependencies = [ bleak pycayennelpp pyserial-asyncio-fast + pycryptodome + ]; + + nativeCheckInputs = [ + pytest-asyncio + pytestCheckHook ]; pythonImportsCheck = [ "meshcore" ]; diff --git a/pkgs/servers/home-assistant/build-custom-component/default.nix b/pkgs/servers/home-assistant/build-custom-component/default.nix index 98fe5115a14d..4e53ae9d56a5 100644 --- a/pkgs/servers/home-assistant/build-custom-component/default.nix +++ b/pkgs/servers/home-assistant/build-custom-component/default.nix @@ -52,13 +52,10 @@ lib.extendMkDerivation { runHook postInstall ''; - nativeBuildInputs = - with home-assistant.python3Packages; - [ - manifestRequirementsCheckHook - packaging - ] - ++ (args.nativeBuildInputs or [ ]); + nativeBuildInputs = [ + manifestRequirementsCheckHook + ] + ++ (args.nativeBuildInputs or [ ]); passthru = { isHomeAssistantComponent = true; diff --git a/pkgs/servers/home-assistant/build-custom-component/manifest-requirements-check-hook.nix b/pkgs/servers/home-assistant/build-custom-component/manifest-requirements-check-hook.nix index bb091bd0e1b4..90faa79d7bbf 100644 --- a/pkgs/servers/home-assistant/build-custom-component/manifest-requirements-check-hook.nix +++ b/pkgs/servers/home-assistant/build-custom-component/manifest-requirements-check-hook.nix @@ -6,6 +6,7 @@ makeSetupHook { name = "manifest-check-hook"; + propagatedNativeBuildInputs = [ python3Packages.packaging ]; substitutions = { pythonCheckInterpreter = python3Packages.python.interpreter; checkManifest = ./check_manifest.py; diff --git a/pkgs/servers/home-assistant/custom-components/meshcore/package.nix b/pkgs/servers/home-assistant/custom-components/meshcore/package.nix new file mode 100644 index 000000000000..3f87437585a0 --- /dev/null +++ b/pkgs/servers/home-assistant/custom-components/meshcore/package.nix @@ -0,0 +1,50 @@ +{ + lib, + fetchFromGitHub, + buildHomeAssistantComponent, + cachetools, + meshcore, + meshcore-cli, + paho-mqtt, + pynacl, + pytest-asyncio, + pytestCheckHook, +}: + +buildHomeAssistantComponent (finalAttrs: { + owner = "meshcore-dev"; + domain = "meshcore"; + version = "2.7.0"; + + src = fetchFromGitHub { + owner = "meshcore-dev"; + repo = "meshcore-ha"; + tag = "v${finalAttrs.version}"; + hash = "sha256-DykWjoMVVKzDa05UtytrkwUej80zteZThi8E3e7M+ZU="; + }; + + dependencies = [ + cachetools + meshcore + meshcore-cli + paho-mqtt + pynacl + ]; + + ignoreVersionRequirement = [ + "meshcore" + ]; + + nativeCheckInputs = [ + pytest-asyncio + pytestCheckHook + ]; + + meta = { + changelog = "https://github.com/meshcore-dev/meshcore-ha/releases/tag/${finalAttrs.src.tag}"; + description = "Home Assistant integration for MeshCore"; + homepage = "https://github.com/meshcore-dev/meshcore-ha/"; + license = lib.licenses.mit; + maintainers = [ lib.maintainers.haylin ]; + }; +}) diff --git a/pkgs/servers/home-assistant/custom-lovelace-modules/meshcore-card/package.nix b/pkgs/servers/home-assistant/custom-lovelace-modules/meshcore-card/package.nix new file mode 100644 index 000000000000..fab17e122838 --- /dev/null +++ b/pkgs/servers/home-assistant/custom-lovelace-modules/meshcore-card/package.nix @@ -0,0 +1,42 @@ +{ + lib, + buildNpmPackage, + fetchFromGitHub, + nix-update-script, +}: + +buildNpmPackage (finalAttrs: { + pname = "meshcore-card"; + version = "0.3.5"; + strictDeps = true; + + src = fetchFromGitHub { + owner = "jpettitt"; + repo = "meshcore-card"; + tag = "v${finalAttrs.version}"; + hash = "sha256-XfqtCGSDrfkNIqWuH8Y8DLacJf9x7iaZXDiKDWdqzhw="; + }; + + npmDepsHash = "sha256-KgG6PGSGw9zCOPboZjo/gpAs2OwLg3LRl3rqenIvTG8="; + + installPhase = '' + runHook preInstall + + mkdir $out + cp dist/${finalAttrs.pname}.js $out/ + + runHook postInstall + ''; + + passthru.updateScript = nix-update-script { }; + + __structuredAttrs = true; + + meta = { + description = "MeshCore Lovelace card for Home Assistant"; + homepage = "https://github.com/jpettitt/meshcore-card"; + changelog = "https://github.com/jpettitt/meshcore-card/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ hexa ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 2d2c5b587e4c..edeaf390c28d 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9898,6 +9898,8 @@ self: super: with self; { meshcore = callPackage ../development/python-modules/meshcore { }; + meshcore-cli = callPackage ../development/python-modules/meshcore-cli { }; + meshio = callPackage ../development/python-modules/meshio { }; meshlabxml = callPackage ../development/python-modules/meshlabxml { };