@@ -158,6 +158,29 @@ in stdenv'.mkDerivation (finalAttrs: {
158158 ln -s $out/Applications/mscore.app/Contents/MacOS/mscore $out/bin/mscore
159159 '' ;
160160
161+ # muse-sounds-manager installs Muse Sounds sampler libMuseSamplerCoreLib.so.
162+ # It requires that argv0 of the calling process ends with "/mscore" or "/MuseScore-4".
163+ # We need to ensure this in two cases:
164+ #
165+ # 1) when the user invokes MuseScore as "mscore" on the command line or from
166+ # the .desktop file, and the normal argv0 is "mscore" (no "/");
167+ # 2) when MuseScore invokes itself via File -> New, and the normal argv0 is
168+ # the target of /proc/self/exe, which in Nixpkgs was "{...}/.mscore-wrapped"
169+ #
170+ # In order to achieve (2) we install the final binary as $out/libexec/mscore, and
171+ # in order to achieve (1) we use makeWrapper without --inherit-argv0.
172+ #
173+ # wrapQtAppsHook uses wrapQtApp -> wrapProgram -> makeBinaryWrapper --inherit-argv0
174+ # so we disable it and explicitly use makeQtWrapper.
175+ #
176+ # TODO: check if something like this is also needed for macOS.
177+ dontWrapQtApps = stdenv . isLinux ;
178+ postFixup = lib . optionalString stdenv . isLinux ''
179+ mkdir -p $out/libexec
180+ mv $out/bin/mscore $out/libexec
181+ makeQtWrapper $out/libexec/mscore $out/bin/mscore
182+ '' ;
183+
161184 # Don't run bundled upstreams tests, as they require a running X window system.
162185 doCheck = false ;
163186
@@ -167,7 +190,7 @@ in stdenv'.mkDerivation (finalAttrs: {
167190 description = "Music notation and composition software" ;
168191 homepage = "https://musescore.org/" ;
169192 license = licenses . gpl3Only ;
170- maintainers = with maintainers ; [ vandenoever doronbehar ] ;
193+ maintainers = with maintainers ; [ vandenoever doronbehar orivej ] ;
171194 mainProgram = "mscore" ;
172195 platforms = platforms . unix ;
173196 } ;
0 commit comments