about summary refs log tree commit diff
path: root/pkgs/applications/audio/viper4linux/default.nix
blob: 134e535a783421cfe09a2fdfa3c947f830dd27bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{ lib
, stdenv
, fetchFromGitHub
, gst_all_1
, libviperfx
, makeWrapper
}:
let
  gstPluginPath = lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" (with gst_all_1; [ gstreamer gst-plugins-viperfx gst-plugins-base gst-plugins-good ]);
in
stdenv.mkDerivation rec {
  pname = "viper4linux";
  version = "unstable-2022-03-13";

  src = fetchFromGitHub {
    owner = "Audio4Linux";
    repo = "Viper4Linux";
    rev = "5da25644824f88cf0db24378d2c84770ba4f6816";
    sha256 = "sha256-CJNVr/1ehJzX45mxunXcRAypBBGEBdswOzAVG2H+ayg=";
  };

  nativeBuildInputs = [ makeWrapper ];

  buildInputs = [
    gst_all_1.gstreamer
    gst_all_1.gst-plugins-base
    gst_all_1.gst-plugins-good
    gst_all_1.gst-plugins-viperfx
    libviperfx
  ];

  dontBuild = true;

  postPatch = ''
    substituteInPlace viper --replace "/etc/viper4linux" "$out/etc/viper4linux"
  '';

  installPhase = ''
    runHook preInstall
    install -D viper -t $out/bin
    mkdir -p $out/etc/viper4linux
    cp -r viper4linux/* $out/etc/viper4linux
    runHook postInstall
  '';

  postFixup = ''
    wrapProgram "$out/bin/viper" \
      --prefix PATH : $out/bin:${lib.makeBinPath [ gst_all_1.gstreamer ]} \
      --prefix GST_PLUGIN_SYSTEM_PATH_1_0 : ${gstPluginPath} \
      --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libviperfx ]}
  '';

  meta = with lib; {
    description = "Adaptive Digital Sound Processor";
    homepage = "https://github.com/Audio4Linux/Viper4Linux";
    license = licenses.gpl3Plus;
    platforms = [ "x86_64-linux" ];
    maintainers = with maintainers; [ rewine ];
  };
}