timidity: add enableVorbis option (#201828)
This commit is contained in:
commit
2bd5a51a15
@ -1048,6 +1048,7 @@ in {
|
||||
tika = runTest ./tika.nix;
|
||||
timescaledb = handleTest ./timescaledb.nix {};
|
||||
timezone = handleTest ./timezone.nix {};
|
||||
timidity = handleTestOn ["aarch64-linux" "x86_64-linux"] ./timidity {};
|
||||
tinc = handleTest ./tinc {};
|
||||
tinydns = handleTest ./tinydns.nix {};
|
||||
tinyproxy = handleTest ./tinyproxy.nix {};
|
||||
|
20
nixos/tests/timidity/basic.nix
Normal file
20
nixos/tests/timidity/basic.nix
Normal file
@ -0,0 +1,20 @@
|
||||
import ../make-test-python.nix (
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
|
||||
name = "timidity";
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [ pkgs.timidity ];
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all ()
|
||||
|
||||
## TiMidity++ is around.
|
||||
machine.succeed("command -v timidity")
|
||||
'';
|
||||
}
|
||||
)
|
4
nixos/tests/timidity/default.nix
Normal file
4
nixos/tests/timidity/default.nix
Normal file
@ -0,0 +1,4 @@
|
||||
inputs: {
|
||||
basic = import ./basic.nix inputs;
|
||||
with-vorbis = import ./with-vorbis.nix inputs;
|
||||
}
|
BIN
nixos/tests/timidity/tam-lin.midi
Normal file
BIN
nixos/tests/timidity/tam-lin.midi
Normal file
Binary file not shown.
40
nixos/tests/timidity/with-vorbis.nix
Normal file
40
nixos/tests/timidity/with-vorbis.nix
Normal file
@ -0,0 +1,40 @@
|
||||
import ../make-test-python.nix (
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
|
||||
name = "timidity-with-vorbis";
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
(timidity.override { enableVorbis = true; })
|
||||
ffmpeg # # for `ffprobe`
|
||||
];
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
import json
|
||||
|
||||
start_all()
|
||||
|
||||
## TiMidity++ is around and it claims to support Ogg Vorbis.
|
||||
machine.succeed("command -v timidity")
|
||||
machine.succeed("timidity --help | grep 'Ogg Vorbis'")
|
||||
|
||||
## TiMidity++ manages to process a MIDI input and produces an Ogg Vorbis
|
||||
## output file. NOTE: the `timidity` CLI succeeds even when the input file
|
||||
## does not exist; hence our test for the output file's existence.
|
||||
machine.succeed("cp ${./tam-lin.midi} tam-lin.midi")
|
||||
machine.succeed("timidity -Ov tam-lin.midi && test -e tam-lin.ogg")
|
||||
|
||||
## The output file has the expected characteristics.
|
||||
metadata_as_text = machine.succeed("ffprobe -show_format -print_format json -i tam-lin.ogg")
|
||||
metadata = json.loads(metadata_as_text)
|
||||
assert metadata['format']['format_name'] == 'ogg', \
|
||||
f"expected 'format_name' to be 'ogg', got '{metadata['format']['format_name']}'"
|
||||
assert 37 <= float(metadata['format']['duration']) <= 38, \
|
||||
f"expected 'duration' to be between 37s and 38s, got {metadata['format']['duration']}s"
|
||||
'';
|
||||
}
|
||||
)
|
@ -1,6 +1,7 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, nixosTests
|
||||
, pkg-config
|
||||
, memstreamHook
|
||||
, CoreAudio
|
||||
@ -9,6 +10,9 @@
|
||||
, ncurses
|
||||
, alsa-lib
|
||||
, buildPackages
|
||||
|
||||
## Additional optional output modes
|
||||
, enableVorbis ? false, libvorbis
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@ -29,6 +33,7 @@ stdenv.mkDerivation rec {
|
||||
|
||||
nativeBuildInputs = [ pkg-config ]
|
||||
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ memstreamHook ];
|
||||
|
||||
buildInputs = [
|
||||
libjack2
|
||||
ncurses
|
||||
@ -37,19 +42,31 @@ stdenv.mkDerivation rec {
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
CoreAudio
|
||||
libobjc
|
||||
] ++ lib.optionals enableVorbis [
|
||||
libvorbis
|
||||
];
|
||||
|
||||
enabledOutputModes = [
|
||||
"jack"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
"oss"
|
||||
"alsa"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
"darwin"
|
||||
] ++ lib.optionals enableVorbis [
|
||||
"vorbis"
|
||||
];
|
||||
|
||||
configureFlags = [
|
||||
"--enable-ncurses"
|
||||
("--enable-audio=" + builtins.concatStringsSep "," enabledOutputModes)
|
||||
"lib_cv_va_copy=yes"
|
||||
"lib_cv___va_copy=yes"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
"--enable-audio=oss,alsa,jack"
|
||||
"--enable-alsaseq"
|
||||
"--with-default-output=alsa"
|
||||
"lib_cv_va_val_copy=yes"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
"--enable-audio=darwin,jack"
|
||||
"lib_cv_va_val_copy=no"
|
||||
"timidity_cv_ccoption_rdynamic=yes"
|
||||
# These configure tests fail because of incompatible function pointer conversions.
|
||||
@ -86,6 +103,8 @@ stdenv.mkDerivation rec {
|
||||
# This fixup step is unnecessary and fails on Darwin
|
||||
dontRewriteSymlinks = stdenv.hostPlatform.isDarwin;
|
||||
|
||||
passthru.tests = nixosTests.timidity;
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://sourceforge.net/projects/timidity/";
|
||||
license = licenses.gpl2Plus;
|
||||
|
Loading…
Reference in New Issue
Block a user