1
0

add n0emis, some packages and pre-yate-n0emis

This commit is contained in:
Ember 'n0emis' Keske
2022-07-07 19:46:59 +02:00
parent b9a581c63f
commit 97ebfe5ad2
21 changed files with 511 additions and 184 deletions

18
packages/default.nix Normal file
View File

@@ -0,0 +1,18 @@
self: super: {
freeradius = super.freeradius.override {
withJson = true;
withRest = true;
};
python3 = let packageOverrides = final: prev: import ./python final prev;
in super.python3.override { inherit packageOverrides; };
yate = super.yate.overrideAttrs (old: {
configureFlags =
[ "--with-libpq=${self.postgresql.withPackages (ps: [ ])}" ];
});
t38modem = self.callPackage ./t38modem.nix { };
ptlib = self.callPackage ./ptlib.nix { };
opal = self.callPackage ./opal.nix { };
}

19
packages/opal.nix Normal file
View File

@@ -0,0 +1,19 @@
{ stdenv, fetchurl, pkg-config, ptlib, openssl, libopus, spandsp }:
let
pname = "opal";
version = "3.18.6";
hash = "sha256-L/0784mYza2p866Fal5pvvQ4IJjC9b5VSFwQ89jSYUw=";
in stdenv.mkDerivation {
inherit pname version;
src = fetchurl {
url =
"mirror://sourceforge/project/opalvoip/v3.18%20Cygni/Stable%206/opal-${version}.tar.bz2";
inherit hash;
};
buildInputs = [ pkg-config ];
nativeBuildInputs = [ ptlib openssl libopus spandsp ];
}

View File

@@ -0,0 +1,43 @@
diff --git a/src/ptlib/unix/channel.cxx b/src/ptlib/unix/channel.cxx
index 2935644..80c8d09 100644
--- a/src/ptlib/unix/channel.cxx
+++ b/src/ptlib/unix/channel.cxx
@@ -34,6 +34,7 @@
#pragma implementation "channel.h"
#pragma implementation "indchan.h"
+#include <sys/uio.h>
#include <ptlib.h>
#include <sys/ioctl.h>
diff --git a/src/ptlib/unix/svcproc.cxx b/src/ptlib/unix/svcproc.cxx
index 4f21025..2c957ef 100644
--- a/src/ptlib/unix/svcproc.cxx
+++ b/src/ptlib/unix/svcproc.cxx
@@ -217,7 +217,7 @@ int PServiceProcess::InitialiseService()
pid_t pid;
{
- ifstream pidfile(pidfilename);
+ ifstream pidfile((const char *)pidfilename);
if (!pidfile.is_open()) {
cout << "Could not open pid file: \"" << pidfilename << "\""
" - " << strerror(errno) << endl;
@@ -384,7 +384,7 @@ int PServiceProcess::InitialiseService()
// Run as a daemon, ie fork
if (!pidfilename) {
- ifstream pidfile(pidfilename);
+ ifstream pidfile((const char *)pidfilename);
if (pidfile.is_open()) {
pid_t pid;
pidfile >> pid;
@@ -412,7 +412,7 @@ int PServiceProcess::InitialiseService()
cout << "Daemon started with pid " << pid << endl;
if (!pidfilename) {
// Write out the child pid to magic file in /var/run (at least for linux)
- ofstream pidfile(pidfilename);
+ ofstream pidfile((const char *)pidfilename);
if (pidfile.is_open())
pidfile << pid;
else

26
packages/ptlib.nix Normal file
View File

@@ -0,0 +1,26 @@
{ stdenv, fetchurl, pkg-config, flex, bison }:
let
pname = "ptlib";
version = "2.18.6";
hash = "sha256-31HndbsCS73uU0yvJW7/YA7s56+9V2itafuLPqllE2Y=";
in stdenv.mkDerivation {
inherit pname version;
src = fetchurl {
url =
"mirror://sourceforge/project/opalvoip/v3.18%20Cygni/Stable%206/ptlib-${version}.tar.bz2";
inherit hash;
};
#patches = [
# ./ptlib-pidfile.patch
#];
buildInputs = [ pkg-config ];
nativeBuildInputs = [ flex bison ];
#NIX_CFLAGS_COMPILE = [ "-fpermissive" ];
#CXXFLAGS = "-std=gnu++98";
}

View File

@@ -0,0 +1,4 @@
self: super: {
python-yate = self.callPackage ./python-yate { };
ywsd = self.callPackage ./ywsd { };
}

View File

@@ -0,0 +1,15 @@
{ lib, buildPythonPackage, fetchPypi, async-timeout }:
buildPythonPackage rec {
pname = "python-yate";
version = "0.3.1";
src = fetchPypi {
inherit pname version;
sha256 = "5e806802dc47a35c855b60cd459a2c98fb0109c7fc099f3e9f83a1a38abf9f90";
};
propagatedBuildInputs = [ async-timeout ];
pythonImportsCheck = [ "yate" ];
}

View File

@@ -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)
)

View File

@@ -0,0 +1,20 @@
{ lib, buildPythonApplication, fetchFromGitHub, aiopg, aiohttp, python-yate
, pyyaml, sqlalchemy }:
buildPythonApplication rec {
pname = "ywsd";
version = "0.11.0";
src = fetchFromGitHub {
owner = "eventphone";
repo = pname;
rev = "v${version}";
sha256 = "sha256-9DloJSKR3Ck4Bsc0ICcAAD6LHIMeOHTe2rCx6nPINT4=";
};
patches = [ ./count.patch ];
propagatedBuildInputs = [ aiopg aiohttp python-yate pyyaml sqlalchemy ];
doCheck = false;
}

33
packages/t38modem.nix Normal file
View File

@@ -0,0 +1,33 @@
{ stdenv, fetchFromGitHub, pkg-config, opal, ptlib }:
let
pname = "t38modem";
version = "4.6.0";
hash = "sha256-631xF1Q9Nd0sMBEHtqgqn1SEUEZweneqLJMNVEO2DJo=";
in stdenv.mkDerivation {
inherit pname version;
src = fetchFromGitHub {
owner = "T38modem";
repo = pname;
rev = "v${version}";
inherit hash;
};
buildInputs = [ pkg-config ];
nativeBuildInputs = [ ptlib opal ];
buildFlags = [
"PTLIBDIR=${ptlib}/share/ptlib"
"USE_OPAL=1"
"OPALDIR=${opal}/share/opal"
];
installPhase = ''
mkdir -p $out/bin
cp t38modem $out/bin
'';
NIX_CFLAGS_COMPILE = [ "-Wno-narrowing" ];
}