about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/audio/famistudio/default.nix
blob: 89d684523755825a6a9b4c9333e28331f841df63 (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
{ lib
, stdenv
, fetchzip
, autoPatchelfHook
, dotnet-runtime
, ffmpeg
, libglvnd
, makeWrapper
, openal
}:

stdenv.mkDerivation rec {
  pname = "famistudio";
  version = "4.1.1";

  src = fetchzip {
    url = "https://github.com/BleuBleu/FamiStudio/releases/download/${version}/FamiStudio${lib.strings.concatStrings (lib.splitVersion version)}-LinuxAMD64.zip";
    stripRoot = false;
    hash = "sha256-fRNjboCfymBhr7Eg5ENnO1fchX0oTdeaJJ0SC3BKTVI=";
  };

  strictDeps = true;

  nativeBuildInputs = [
    autoPatchelfHook
    makeWrapper
  ];

  buildInputs = [
    dotnet-runtime
    ffmpeg
    libglvnd
    openal
  ];

  dontConfigure = true;
  dontBuild = true;

  installPhase = ''
    runHook preInstall

    mkdir -p $out/{bin,lib/famistudio}
    mv * $out/lib/famistudio

    makeWrapper ${lib.getExe dotnet-runtime} $out/bin/famistudio \
      --add-flags $out/lib/famistudio/FamiStudio.dll \
      --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libglvnd ]} \
      --prefix PATH : ${lib.makeBinPath [ ffmpeg ]}

    # Bundled openal lib freezes the application
    rm $out/lib/famistudio/libopenal32.so
    ln -s ${openal}/lib/libopenal.so $out/lib/famistudio/libopenal32.so

    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://famistudio.org/";
    description = "NES Music Editor";
    longDescription = ''
      FamiStudio is very simple music editor for the Nintendo Entertainment System
      or Famicom. It is targeted at both chiptune artists and NES homebrewers.
    '';
    license = licenses.mit;
    # Maybe possible to build from source but I'm not too familiar with C# packaging
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    maintainers = with maintainers; [ OPNA2608 ];
    platforms = [ "x86_64-linux" ];
  };
}