commit 34f80ca17177970509acc5682bb38ebdeb30f05d
parent 867f69030dc7b8619e490d75b2703003b07f5cb6
Author: Nikolay Korotkiy <sikmir@disroot.org>
Date: Thu, 26 Jan 2023 02:08:25 +0300
Add modbus_sim_cli
Diffstat:
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -320,6 +320,7 @@ lib.makeScope newScope (
modbus-tools = callPackage ./misc/modbus-tools {
inherit (darwin.apple_sdk.frameworks) IOKit;
};
+ modbus_sim_cli = callPackage ./misc/modbus_sim_cli { };
morse-talk = callPackage ./misc/morse-talk { };
musig = callPackage ./misc/musig { };
nanodns = callPackage ./misc/nanodns { };
diff --git a/pkgs/misc/modbus_sim_cli/default.nix b/pkgs/misc/modbus_sim_cli/default.nix
@@ -0,0 +1,40 @@
+{ lib, python3Packages, fetchFromGitHub, modbus_tk }:
+
+python3Packages.buildPythonApplication rec {
+ pname = "modbus_sim_cli";
+ version = "2019-02-27";
+
+ src = fetchFromGitHub {
+ owner = "dhoomakethu";
+ repo = "modbus_sim_cli";
+ rev = "080d773b7009fa9aa727097d2b2f8049b3f35290";
+ hash = "sha256-ijW462q+xhw2I7ZXBhALq3xcSIUi/uEWrva+TCxkKzA=";
+ };
+
+ postPatch = ''
+ sed -i 's/==.*//;/trollius/d' requirements
+ substituteInPlace modbus_sim/utils/config_parser.py \
+ --replace "yaml.load(conffile.read())" "yaml.safe_load(conffile)"
+ '';
+
+ propagatedBuildInputs = with python3Packages; [
+ coloredlogs
+ modbus_tk
+ pyyaml
+ ];
+
+ preConfigure = ''
+ find modbus_sim -name "*.py" | xargs 2to3 -w
+ '';
+
+ preBuild = ''
+ export HOME=$TMPDIR
+ '';
+
+ meta = with lib; {
+ description = "Modbus simulation command line version";
+ inherit (src.meta) homepage;
+ license = licenses.mit;
+ maintainers = [ maintainers.sikmir ];
+ };
+}