about summary refs log tree commit diff
path: root/pkgs/applications/audio/transcribe/default.nix
blob: 785550a0a040b3dfcec911792fbcc37f9bd1ffb9 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{ stdenv
, fetchzip
, lib
, wrapGAppsHook3
, xdg-utils
, which
, alsa-lib
, atk
, cairo
, fontconfig
, gdk-pixbuf
, glib
, gst_all_1
, gtk3
, libSM
, libX11
, libXtst
, libpng12
, pango
, zlib
}:

stdenv.mkDerivation rec {
  pname = "transcribe";
  version = "9.40.0";

  src =
    if stdenv.hostPlatform.system == "x86_64-linux" then
      fetchzip
        {
          url = "https://www.seventhstring.com/xscribe/downlo/xscsetup-${version}.tar.gz";
          sha256 = "sha256-GHTr1rk7Kh5M0UYnryUlCk/G6pW3p80GJ6Ai0zXdfNs=";
        }
    else throw "Platform not supported";

  nativeBuildInputs = [
    which
    xdg-utils
    wrapGAppsHook3
  ];

  buildInputs = with gst_all_1; [
    gst-plugins-base
    gst-plugins-good
    gst-plugins-bad
    gst-plugins-ugly
  ];

  dontPatchELF = true;

  libPath = with gst_all_1; lib.makeLibraryPath [
    stdenv.cc.cc
    glib
    gtk3
    atk
    fontconfig
    pango
    cairo
    gdk-pixbuf
    alsa-lib
    libX11
    libXtst
    libSM
    libpng12
    gstreamer
    gst-plugins-base
    zlib
  ];

  installPhase = ''
    mkdir -p $out/bin $out/libexec $out/share/doc
    cp transcribe $out/libexec
    cp xschelp.htb readme_gtk.html $out/share/doc
    ln -s $out/share/doc/xschelp.htb $out/libexec
    # The script normally installs to the home dir
    sed -i -E 's!BIN_DST=.*!BIN_DST=$out!' install-linux.sh
    sed -i -e 's!Exec=''${BIN_DST}/transcribe/transcribe!Exec=transcribe!' install-linux.sh
    sed -i -e 's!''${BIN_DST}/transcribe!''${BIN_DST}/libexec!' install-linux.sh
    rm -f xschelp.htb readme_gtk.html *.so
    XDG_DATA_HOME=$out/share bash install-linux.sh -i
    patchelf \
      --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
      $out/libexec/transcribe
  '';

  preFixup = ''
    gappsWrapperArgs+=(
      --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH_1_0"
      --prefix LD_LIBRARY_PATH : "${libPath}"
    )
  '';

  postFixup = ''
    ln -s $out/libexec/transcribe $out/bin/
  '';

  meta = with lib; {
    description = "Software to help transcribe recorded music";
    longDescription = ''
      The Transcribe! application is an assistant for people who want
      to work out a piece of music from a recording, in order to write
      it out, or play it themselves, or both. It doesn't do the
      transcribing for you, but it is essentially a specialised player
      program which is optimised for the purpose of transcription. It
      has many transcription-specific features not found on
      conventional music players.
    '';
    homepage = "https://www.seventhstring.com/xscribe/";
    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
    license = licenses.unfree;
    maintainers = with maintainers; [ iwanb ];
    platforms = platforms.linux;
    mainProgram = "transcribe";
  };
}