diff --git a/hosts/pre-yate-n0emis/configuration.nix b/hosts/pre-yate-n0emis/configuration.nix index 8b54818..dab932e 100644 --- a/hosts/pre-yate-n0emis/configuration.nix +++ b/hosts/pre-yate-n0emis/configuration.nix @@ -27,6 +27,8 @@ }; }; + environment.systemPackages = with pkgs; [ python3.pkgs.fieldpoc ]; + # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave diff --git a/packages/python/default.nix b/packages/python/default.nix index 74cfb2d..d97ab40 100644 --- a/packages/python/default.nix +++ b/packages/python/default.nix @@ -1,4 +1,7 @@ self: super: { + diffsync = self.callPackage ./diffsync { }; python-yate = self.callPackage ./python-yate { }; ywsd = self.callPackage ./ywsd { }; + mitel-ommclient2 = self.callPackage ./mitel-ommclient2 { }; + fieldpoc = self.callPackage ./fieldpoc { }; } diff --git a/packages/python/diffsync/default.nix b/packages/python/diffsync/default.nix new file mode 100644 index 0000000..75dfbd3 --- /dev/null +++ b/packages/python/diffsync/default.nix @@ -0,0 +1,15 @@ +{ lib, buildPythonPackage, fetchPypi, pydantic, structlog, colorama, redis }: + +buildPythonPackage rec { + pname = "diffsync"; + version = "1.5.1"; + + src = fetchPypi { + inherit pname version; + sha256 = "84a736d03d385bd07cf7c86f57385d4130c3c3273bf7bc90febe2fa530ee1aa6"; + }; + + propagatedBuildInputs = [ pydantic structlog colorama redis ]; + + pythonImportsCheck = [ "diffsync" ]; +} diff --git a/packages/python/fieldpoc/count.patch b/packages/python/fieldpoc/count.patch new file mode 100644 index 0000000..0455b78 --- /dev/null +++ b/packages/python/fieldpoc/count.patch @@ -0,0 +1,14 @@ +diff --git a/ywsd/objects.py b/ywsd/objects.py +index 4ce29fb..a535e76 100644 +--- a/ywsd/objects.py ++++ b/ywsd/objects.py +@@ -178,7 +178,8 @@ class ActiveCall: + async def is_active_call(cls, username, x_eventphone_id, db_connection): + return ( + await db_connection.scalar( +- cls.table.count() ++ sa.select(sa.func.count('*')) ++ .select_from(cls.table) + .where(cls.table.c.username == username) + .where(cls.table.c.x_eventphone_id == x_eventphone_id) + ) diff --git a/packages/python/fieldpoc/default.nix b/packages/python/fieldpoc/default.nix new file mode 100644 index 0000000..16e626f --- /dev/null +++ b/packages/python/fieldpoc/default.nix @@ -0,0 +1,17 @@ +{ lib, buildPythonApplication, hatchling, mitel-ommclient2, sqlalchemy, ywsd, diffsync }: + +buildPythonApplication rec { + pname = "fieldpoc"; + version = "0.11.0"; + + src = fetchGit { + url = "https://git.clerie.de/clerie/fieldpoc.git"; + ref = "main"; + rev = "c2ef36c5a7a31ea39f51c91c7ba76430f0aaa048"; + }; + + format = "pyproject"; + + buildInputs = [ hatchling ]; + propagatedBuildInputs = [ mitel-ommclient2 sqlalchemy ywsd diffsync ]; +} diff --git a/packages/python/mitel-ommclient2/default.nix b/packages/python/mitel-ommclient2/default.nix new file mode 100644 index 0000000..683ddd1 --- /dev/null +++ b/packages/python/mitel-ommclient2/default.nix @@ -0,0 +1,19 @@ +{ lib, buildPythonPackage, hatchling, rsa }: + +buildPythonPackage rec { + pname = "mitel-ommclient2"; + version = "0.0.1"; + + src = fetchGit { + url = "https://git.clerie.de/clerie/mitel_ommclient2.git"; + ref = "main"; + rev = "f05ffdd86d7e0694fcea573e8ba246a59cd99bdc"; + }; + + format = "pyproject"; + + buildInputs = [ hatchling ]; + propagatedBuildInputs = [ rsa ]; + + pythonImportsCheck = [ "mitel_ommclient2" ]; +}