lol
1{ pname, chip, version, sha256, extraPatches ? [] }:
2
3{ mkDerivation
4, stdenv
5, lib
6, fetchFromGitHub
7, dos2unix
8, cmake
9, pkg-config
10, qttools
11, qtbase
12, qwt
13, rtaudio
14, rtmidi
15}:
16
17let
18 binname = "${chip} Bank Editor";
19 mainProgram = "${lib.strings.toLower chip}_bank_editor";
20in
21mkDerivation rec {
22 inherit pname version;
23
24 src = fetchFromGitHub {
25 owner = "Wohlstand";
26 repo = pname;
27 rev = "v${version}";
28 inherit sha256;
29 };
30
31 prePatch = ''
32 dos2unix CMakeLists.txt
33 '';
34
35 patches = extraPatches;
36
37 nativeBuildInputs = [
38 dos2unix
39 cmake
40 pkg-config
41 qttools
42 ];
43
44 buildInputs = [
45 qtbase
46 qwt
47 rtaudio
48 rtmidi
49 ];
50
51 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
52 mkdir $out/{bin,Applications}
53 mv "${binname}.app" $out/Applications/
54
55 install_name_tool -change {,${qwt}/lib/}libqwt.6.dylib "$out/Applications/${binname}.app/Contents/MacOS/${binname}"
56
57 ln -s "$out/Applications/${binname}.app/Contents/MacOS/${binname}" $out/bin/${mainProgram}
58 '';
59
60 meta = with lib; {
61 inherit mainProgram;
62 description = "A small cross-platform editor of the ${chip} FM banks of different formats";
63 homepage = src.meta.homepage;
64 license = licenses.gpl3Plus;
65 platforms = platforms.all;
66 maintainers = with maintainers; [ OPNA2608 ];
67 };
68}