37 stdenv.mkDerivation (finalAttrs: {
41 src = fetchFromGitHub {
44 rev = "v${finalAttrs.version}";
45 sha256 = "sha256-bHpPhav9JBPkwJA9o+IFHRWbvxWnGkD1wHBHS4XJ/YE=";
49 "-DMUSE_APP_BUILD_MODE=release"
50 # Disable the build and usage of the `/bin/crashpad_handler` utility - it's
51 # not useful on NixOS, see:
52 # https://github.com/musescore/MuseScore/issues/15571
53 "-DMUSE_MODULE_DIAGNOSTICS_CRASHPAD_CLIENT=OFF"
54 # Use our versions of system libraries
55 "-DMUE_COMPILE_USE_SYSTEM_FREETYPE=ON"
56 "-DMUE_COMPILE_USE_SYSTEM_HARFBUZZ=ON"
57 "-DMUE_COMPILE_USE_SYSTEM_TINYXML=ON"
58 # Implies also -DMUE_COMPILE_USE_SYSTEM_OPUS=ON
59 "-DMUE_COMPILE_USE_SYSTEM_OPUSENC=ON"
60 "-DMUE_COMPILE_USE_SYSTEM_FLAC=ON"
61 # Don't bundle qt qml files, relevant really only for darwin, but we set
62 # this for all platforms anyway.
63 "-DMUE_COMPILE_INSTALL_QTQML_FILES=OFF"
64 # Don't build unit tests unless we are going to run them.
65 (lib.cmakeBool "MUSE_ENABLE_UNIT_TESTS" finalAttrs.finalPackage.doCheck)
69 # MuseScore JACK backend loads libjack at runtime.
70 "--prefix ${lib.optionalString stdenv.hostPlatform.isDarwin "DY"}LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libjack2 ]}"
71 ] ++ lib.optionals (stdenv.hostPlatform.isLinux) [
72 "--set ALSA_PLUGIN_DIR ${alsa-plugins}/lib/alsa-lib"
73 ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
74 # There are some issues with using the wayland backend, see:
75 # https://musescore.org/en/node/321936
76 "--set-default QT_QPA_PLATFORM xcb"
80 qtWrapperArgs+=("''${gappsWrapperArgs[@]}")
91 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
92 # Since https://github.com/musescore/MuseScore/pull/13847/commits/685ac998
93 # GTK3 is needed for file dialogs. Fixes crash with No GSettings schemas error.
117 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
120 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
125 # Remove unneeded bundled libraries and headers
126 rm -r $out/{include,lib}
127 '' + lib.optionalString stdenv.hostPlatform.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 # muse-sounds-manager installs Muse Sounds sampler libMuseSamplerCoreLib.so.
135 # It requires that argv0 of the calling process ends with "/mscore" or "/MuseScore-4".
136 # We need to ensure this in two cases:
138 # 1) when the user invokes MuseScore as "mscore" on the command line or from
139 # the .desktop file, and the normal argv0 is "mscore" (no "/");
140 # 2) when MuseScore invokes itself via File -> New, and the normal argv0 is
141 # the target of /proc/self/exe, which in Nixpkgs was "{...}/.mscore-wrapped"
143 # In order to achieve (2) we install the final binary as $out/libexec/mscore, and
144 # in order to achieve (1) we use makeWrapper without --inherit-argv0.
146 # wrapQtAppsHook uses wrapQtApp -> wrapProgram -> makeBinaryWrapper --inherit-argv0
147 # so we disable it and explicitly use makeQtWrapper.
149 # TODO: check if something like this is also needed for macOS.
150 dontWrapQtApps = stdenv.hostPlatform.isLinux;
151 postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
152 mkdir -p $out/libexec
153 mv $out/bin/mscore $out/libexec
154 makeQtWrapper $out/libexec/mscore $out/bin/mscore
157 # Don't run bundled upstreams tests, as they require a running X window system.
160 passthru.tests = nixosTests.musescore;
163 description = "Music notation and composition software";
164 homepage = "https://musescore.org/";
165 license = licenses.gpl3Only;
166 maintainers = with maintainers; [ vandenoever doronbehar orivej ];
167 mainProgram = "mscore";
168 platforms = platforms.unix;