biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / applications / audio / musescore / default.nix
blob707ec5c8ebfe8c22d3a0741fd93e0e389edcb446
1 { stdenv
2 , lib
3 , fetchFromGitHub
4 , cmake
5 , wrapQtAppsHook
6 , pkg-config
7 , ninja
8 , alsa-lib
9 , alsa-plugins
10 , freetype
11 , libjack2
12 , lame
13 , libogg
14 , libpulseaudio
15 , libsndfile
16 , libvorbis
17 , portaudio
18 , portmidi
19 , qtbase
20 , qtdeclarative
21 , qtgraphicaleffects
22 , flac
23 , qtquickcontrols
24 , qtquickcontrols2
25 , qtscript
26 , qtsvg
27 , qtxmlpatterns
28 , qtnetworkauth
29 , qtx11extras
30 , nixosTests
31 , darwin
34 let
35   stdenv' = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
36   # portaudio propagates Darwin frameworks. Rebuild it using the 11.0 stdenv
37   # from Qt and the 11.0 SDK frameworks.
38   portaudio' = if stdenv.isDarwin then portaudio.override {
39     stdenv = stdenv';
40     inherit (darwin.apple_sdk_11_0.frameworks)
41       AudioUnit
42       AudioToolbox
43       CoreAudio
44       CoreServices
45       Carbon
46     ;
47   } else portaudio;
48 in stdenv'.mkDerivation (finalAttrs: {
49   pname = "musescore";
50   version = "4.2.1";
52   src = fetchFromGitHub {
53     owner = "musescore";
54     repo = "MuseScore";
55     rev = "v${finalAttrs.version}";
56     sha256 = "sha256-YCeO/ijxA+tZxNviqmlIBkAdjPTrKoOoo1QyMIOqhWU=";
57   };
59   cmakeFlags = [
60     "-DMUSESCORE_BUILD_MODE=release"
61     # Disable the build and usage of the `/bin/crashpad_handler` utility - it's
62     # not useful on NixOS, see:
63     # https://github.com/musescore/MuseScore/issues/15571
64     "-DMUE_BUILD_CRASHPAD_CLIENT=OFF"
65     # Use our freetype
66     "-DMUE_COMPILE_USE_SYSTEM_FREETYPE=ON"
67     # From some reason, in $src/build/cmake/SetupBuildEnvironment.cmake,
68     # upstream defaults to compiling to x86_64 only, unless this cmake flag is
69     # set
70     "-DMUE_COMPILE_BUILD_MACOS_APPLE_SILICON=ON"
71     # Don't bundle qt qml files, relevant really only for darwin, but we set
72     # this for all platforms anyway.
73     "-DMUE_COMPILE_INSTALL_QTQML_FILES=OFF"
74   ];
76   qtWrapperArgs = [
77     # MuseScore JACK backend loads libjack at runtime.
78     "--prefix ${lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libjack2 ]}"
79   ] ++ lib.optionals (stdenv.isLinux) [
80     "--set ALSA_PLUGIN_DIR ${alsa-plugins}/lib/alsa-lib"
81   ] ++ lib.optionals (!stdenv.isDarwin) [
82     # There are some issues with using the wayland backend, see:
83     # https://musescore.org/en/node/321936
84     "--set-default QT_QPA_PLATFORM xcb"
85   ];
87   # HACK `propagatedSandboxProfile` does not appear to actually propagate the
88   # sandbox profile from `qtbase`, see:
89   # https://github.com/NixOS/nixpkgs/issues/237458
90   sandboxProfile = toString qtbase.__propagatedSandboxProfile or null;
92   nativeBuildInputs = [
93     wrapQtAppsHook
94     cmake
95     pkg-config
96     ninja
97   ];
99   buildInputs = [
100     libjack2
101     freetype
102     lame
103     libogg
104     libpulseaudio
105     libsndfile
106     libvorbis
107     portaudio'
108     portmidi
109     flac
110     qtbase
111     qtdeclarative
112     qtgraphicaleffects
113     qtquickcontrols
114     qtquickcontrols2
115     qtscript
116     qtsvg
117     qtxmlpatterns
118     qtnetworkauth
119     qtx11extras
120   ] ++ lib.optionals stdenv.isLinux [
121     alsa-lib
122   ];
124   postInstall = ''
125     # Remove unneeded bundled libraries and headers
126     rm -r $out/{include,lib}
127   '' + lib.optionalString stdenv.isDarwin ''
128     mkdir -p "$out/Applications"
129     mv "$out/mscore.app" "$out/Applications/mscore.app"
130     mkdir -p $out/bin
131     ln -s $out/Applications/mscore.app/Contents/MacOS/mscore $out/bin/mscore
132   '';
134   # Don't run bundled upstreams tests, as they require a running X window system.
135   doCheck = false;
137   passthru.tests = nixosTests.musescore;
139   meta = with lib; {
140     description = "Music notation and composition software";
141     homepage = "https://musescore.org/";
142     license = licenses.gpl3Only;
143     maintainers = with maintainers; [ vandenoever doronbehar ];
144     mainProgram = "mscore";
145     platforms = platforms.unix;
146   };