Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchurl,
6 cmake,
7 codec2,
8 sox,
9}:
10
11stdenv.mkDerivation (finalAttrs: {
12 pname = "LPCNet";
13 version = "0.5-unstable-2025-01-19";
14
15 src = fetchFromGitHub {
16 owner = "drowe67";
17 repo = "LPCNet";
18 rev = "c8e51ac5e2fe674849cb53e7da44689b572cc246";
19 sha256 = "sha256-0Knoym+deTuFAyJrrD55MijVh6DlhJp3lss66BJUHiA=";
20 };
21
22 patches = [
23 # extracted from https://github.com/drowe67/LPCNet/pull/59
24 ./darwin.patch
25 ];
26
27 passthru = {
28 # Prebuilt neural network model that is needed during the build - can be overwritten
29 nnmodel = fetchurl {
30 url = "http://rowetel.com/downloads/deep/lpcnet_191005_v1.0.tgz";
31 hash = "sha256-UJRAkkdR/dh/+qVoPuPd3ZN69cgzuRBMzOZdUWFJJsg=";
32 };
33 };
34
35 preConfigure = ''
36 mkdir build
37 cp \
38 ${finalAttrs.finalPackage.passthru.nnmodel} \
39 build/${finalAttrs.finalPackage.passthru.nnmodel.name}
40 '';
41
42 nativeBuildInputs = [
43 cmake
44 ];
45
46 buildInputs = [
47 codec2
48 ];
49
50 doCheck = true;
51 nativeCheckInputs = [
52 # NOTE: From some reason, the tests pass without this on x86_64-linux, but
53 # not on aarch64-linux, although the relevant test is not enabled
54 # conditionally, see:
55 # https://github.com/drowe67/LPCNet/blob/c8e51ac5e2fe674849cb53e7da44689b572cc246/CMakeLists.txt#L220-L225
56 sox
57 ];
58
59 meta = {
60 description = "Experimental Neural Net speech coding for FreeDV";
61 homepage = "https://github.com/drowe67/LPCNet";
62 license = lib.licenses.bsd3;
63 maintainers = with lib.maintainers; [
64 doronbehar
65 mvs
66 ];
67 platforms = lib.platforms.all;
68 };
69})