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 {
40 inherit (darwin.apple_sdk_11_0.frameworks)
48 in stdenv'.mkDerivation (finalAttrs: {
52 src = fetchFromGitHub {
55 rev = "v${finalAttrs.version}";
56 sha256 = "sha256-YCeO/ijxA+tZxNviqmlIBkAdjPTrKoOoo1QyMIOqhWU=";
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"
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
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"
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"
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;
120 ] ++ lib.optionals stdenv.isLinux [
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"
131 ln -s $out/Applications/mscore.app/Contents/MacOS/mscore $out/bin/mscore
134 # Don't run bundled upstreams tests, as they require a running X window system.
137 passthru.tests = nixosTests.musescore;
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;