package grott, libscrc

master
Yorick van Pelt 2023-04-03 16:26:25 +02:00
parent 3043279dd5
commit 28b2f7b05a
Signed by: yorick
GPG Key ID: A36E70F9DC014A15
3 changed files with 54 additions and 0 deletions

View File

@ -35,5 +35,11 @@
});
wayland-push-to-talk-fix = self.callPackage ./wayland-push-to-talk-fix.nix {};
y-deployer = self.callPackage ../deployer/package.nix {};
grott = self.callPackage ./grott.nix {};
python3 = super.python3.override {
packageOverrides = pyself: pysuper: {
libscrc = pyself.callPackage ./libscrc.nix {};
};
};
})

26
pkgs/grott.nix Normal file
View File

@ -0,0 +1,26 @@
{ stdenv, python3, fetchFromGitHub, makeWrapper }:
let
python = python3.withPackages (p: [ p.paho-mqtt p.libscrc ]);
in
stdenv.mkDerivation (o: {
pname = "grott";
version = "2.7.8";
src = fetchFromGitHub {
owner = "johanmeijer";
repo = o.pname;
rev = "cb7e3db8a9ea2ab11fad062d68a3e98e6a87cedf";
sha256 = "rFxSQZypa+G45jj/ktJLlqfMIp1yHoEmfzB1BvHLeLo=";
};
nativeBuildInputs = [ makeWrapper ];
buildPhase = "true";
installPhase = ''
mkdir -p $out/share/grott
cp *.py examples/recwl.txt examples/Home\ Assistent/grott_ha.py $out/share/grott/
makeWrapper ${python}/bin/python3 $out/bin/grott \
--add-flags $out/share/grott/grott.py
'';
meta = with stdenv.lib; {
description = "Grott is a program to read data from a Growatt inverter and send it to a MQTT broker";
homepage = o.src.homePage;
};
})

22
pkgs/libscrc.nix Normal file
View File

@ -0,0 +1,22 @@
{ lib, buildPythonPackage, fetchPypi }:
buildPythonPackage rec {
pname = "libscrc";
version = "1.8.1";
src = fetchPypi {
inherit pname version;
hash = "sha256-17pr8jz96ztynQrTeV9sb5fY6kFVJS48qfFHWHArp8g=";
};
propagatedBuildInputs = [];
pythonImportsCheck = [ "libscrc" ];
meta = with lib; {
description = "A library for calculating CRC, CRC-ITU, CRC-32, CRC-16, CRC-CCITT";
homepage = "https://github.com/hex-in/libscrc";
license = licenses.mit;
maintainers = with maintainers; [ yorickvp ];
};
}