Add Nix flake for the project (#232)

* Add Nix flake for the project

* Add `codec2` library for M17 encoding support
This commit is contained in:
ChronosXYZ 2024-03-24 05:13:12 +03:00 committed by GitHub
parent f36df3ea09
commit f05ddf8fcd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 130 additions and 1 deletions

3
.gitignore vendored
View File

@ -8,4 +8,5 @@ examples
*.bin *.bin
*.ans *.ans
*.patch *.patch
*.zip *.zip
result

64
flake.lock Normal file
View File

@ -0,0 +1,64 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1709336216,
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1711163522,
"narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1709237383,
"narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

18
flake.nix Normal file
View File

@ -0,0 +1,18 @@
{
description = "Digital Speech Decoder - Florida Man Edition ";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
perSystem = { config, pkgs, ... }: {
packages.default = config.packages.dsd-fme;
packages.dsd-fme = pkgs.callPackage ./package.nix { };
};
};
}

46
package.nix Normal file
View File

@ -0,0 +1,46 @@
{ lib
, stdenv
, cmake
, mbelib
, libsndfile
, ncurses
, pulseaudio
, rtl-sdr
, itpp
, codec2
, portaudioSupport ? true
, portaudio ? null
}:
assert portaudioSupport -> portaudio != null;
stdenv.mkDerivation {
name = "dsd-fme";
src = ./.;
nativeBuildInputs = [ cmake ];
buildInputs = [
mbelib
libsndfile
itpp
rtl-sdr
ncurses.dev
pulseaudio.dev
codec2
] ++ lib.optionals portaudioSupport [ portaudio ];
doCheck = true;
meta = with lib; {
description = "Digital Speech Decoder - Florida Man Edition";
longDescription = ''
DSD is able to decode several digital voice formats from discriminator
tap audio and synthesize the decoded speech. Speech synthesis requires
mbelib, which is a separate package.
'';
homepage = "https://github.com/szechyjs/dsd";
license = licenses.mit;
platforms = platforms.unix;
};
}