This commit is contained in:
Dominic Grimm 2025-06-21 20:48:13 +02:00
commit 54a5bbac6a
Signed by: dergrimm
SSH key fingerprint: SHA256:0uoWpcqOtkyvQ+ZqBjNYiDqIZY+9s8VeZkkJ/4ryB4E
7 changed files with 233 additions and 0 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
result
/.envrc
/.direnv/

27
flake.lock generated Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1750400657,
"narHash": "sha256-3vkjFnxCOP6vm5Pm13wC/Zy6/VYgei/I/2DWgW4RFeA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b2485d56967598da068b5a6946dadda8bfcbcd37",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

40
flake.nix Normal file
View file

@ -0,0 +1,40 @@
{
description = "t38modem packaged for NixOS";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
};
outputs =
{ self, nixpkgs }:
let
systems = [
"x86_64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
in
{
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
import ./pkgs { inherit pkgs; }
);
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShell {
buildInputs = with pkgs; [
minicom
];
};
}
);
};
}

8
pkgs/default.nix Normal file
View file

@ -0,0 +1,8 @@
{ pkgs, ... }:
rec {
ptlib = pkgs.callPackage ./ptlib.nix { };
opal = pkgs.callPackage ./opal.nix { inherit ptlib; };
t38modem = pkgs.callPackage ./t38modem.nix { inherit ptlib opal; };
default = t38modem;
}

53
pkgs/opal.nix Normal file
View file

@ -0,0 +1,53 @@
{
stdenv,
lib,
fetchurl,
ptlib,
pkgs,
}:
let
version = "3.18.6";
downloadPath = lib.strings.escapeURL "v3.18 Cygni/Stable 6/opal-3.18.6";
in
stdenv.mkDerivation {
pname = "opal";
inherit version;
src = fetchurl {
url = "mirror://sourceforge/opalvoip/${downloadPath}.tar.bz2";
hash = "sha256-L/0784mYza2p866Fal5pvvQ4IJjC9b5VSFwQ89jSYUw=";
};
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs =
(with pkgs; [
openssl
spandsp
srtp
libopus
])
++ [ ptlib ];
# configureFlags = [
# # "--with-openssl-dir=${pkgs.openssl.dev}"
# "--disable-srtp"
# ];
enableParallelBuilding = true;
strictDeps = true;
doCheck = true;
configurePhase = ''
PTLIBPLUGINDIR="${ptlib}/lib/ptlib-${ptlib.version}:$out/lib/opal-${version}"
./configure --prefix=$out
'';
meta = {
description = "OPAL";
homepage = "https://sourceforge.net/projects/opalvoip/";
platforms = with lib.platforms; unix;
license = lib.licenses.mpl10;
downloadPage = "https://sourceforge.net/projects/opalvoip/files/";
};
}

43
pkgs/ptlib.nix Normal file
View file

@ -0,0 +1,43 @@
{
stdenv,
lib,
fetchurl,
pkgs,
}:
let
version = "2.18.6";
downloadPath = lib.strings.escapeURL "v3.18 Cygni/Stable 6/ptlib-2.18.6";
in
stdenv.mkDerivation {
pname = "ptlib";
inherit version;
src = fetchurl {
url = "mirror://sourceforge/opalvoip/${downloadPath}.tar.bz2";
hash = "sha256-31HndbsCS73uU0yvJW7/YA7s56+9V2itafuLPqllE2Y=";
};
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [
flex
bison
];
enableParallelBuilding = true;
strictDeps = true;
doCheck = true;
configurePhase = ''
PTLIBPLUGINDIR="$out/lib/ptlib-${version}"
./configure --prefix=$out
'';
meta = {
description = "ptlib";
homepage = "https://sourceforge.net/projects/opalvoip/";
platforms = with lib.platforms; unix;
license = lib.licenses.mpl10;
downloadPage = "https://sourceforge.net/projects/opalvoip/files/";
};
}

58
pkgs/t38modem.nix Normal file
View file

@ -0,0 +1,58 @@
{
stdenv,
lib,
fetchFromGitHub,
pkg-config,
makeWrapper,
ptlib,
opal,
}:
let
version = "4.6.2";
in
stdenv.mkDerivation {
pname = "t38modem";
inherit version;
src = fetchFromGitHub {
owner = "hehol";
repo = "t38modem";
rev = version;
hash = "sha256-QzAuEndRA3Vyucq5WAKLhvfoIOyqpWfnXseHvYdCUQU=";
};
nativeBuildInputs = [
pkg-config
makeWrapper
];
buildInputs = [
ptlib
opal
];
strictDeps = true;
buildPhase = ''
PTLIBPLUGINDIR="${ptlib}/lib/ptlib-${ptlib.version}:${opal}/lib/opal-${opal.version}"
NIX_CFLAGS_COMPILE="-Wno-narrowing $NIX_CFLAGS_COMPILE"
make
'';
installPhase = ''
mkdir -p $out/bin
install -m755 ./t38modem $out/bin/t38modem
wrapProgram $out/bin/t38modem \
--set LD_LIBRARY_PATH "${ptlib}/lib:${opal}/lib" \
--set PTLIBPLUGINDIR "${ptlib}/lib/ptlib-${ptlib.version}:${opal}/lib/opal-${opal.version}"
'';
meta = {
description = "t38modem";
homepage = "https://github.com/hehol/t38modem";
platforms = with lib.platforms; unix;
license = lib.licenses.mpl10;
downloadPage = "https://github.com/hehol/t38modem/releases/tag/${version}";
};
}