musescore: fix qtdeclarative crash

See https://github.com/musescore/MuseScore/issues/33015

Fixes #526825 until PR #527323 reaches branch `master`.
This commit is contained in:
Doron Behar
2026-06-03 12:55:36 +03:00
parent dd5470e785
commit e9ac5f0e92
+57 -9
View File
@@ -2,6 +2,7 @@
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
# nativeBuildInputs
cmake,
@@ -33,6 +34,53 @@
nixosTests,
}:
let
# TODO(@doronbehar): Contribute this one day to lib/? See:
# https://discourse.nixos.org/t/rfc-nix-function-that-overrides-a-scope-with-automatic-inheritance-propagation/78025
overrideScopeFully =
s: scopeOverrideFunc:
let
partiallyOverriddenScope = s.overrideScope scopeOverrideFunc;
directlyOverriddenAttrs = builtins.attrNames (scopeOverrideFunc partiallyOverriddenScope s);
in
builtins.mapAttrs (
attrName: pkg:
pkg.override (
lib.pipe directlyOverriddenAttrs [
(builtins.filter (
oAttr:
# Don't include in this filter the attribute `attrName` from the
# full scope, if it is already part of the _directly_ overridden
# attributes.
!(builtins.elem attrName directlyOverriddenAttrs)
&& pkg ? override
# Continue with the creation of the `.override` arguments only for
# overridden attributes (`oAttr`) which are possible arguments to the
# `.override` function of the `pkg` at hand.
&& pkg.override.__functionArgs ? ${oAttr}
))
# Generate the `.override` argument using the attribute names `aNames`
(aNames: lib.genAttrs aNames (oAttr: partiallyOverriddenScope.${oAttr}))
]
)
) partiallyOverriddenScope;
kdePackages' = overrideScopeFully kdePackages (
self: super: {
# Fix for: https://github.com/NixOS/nixpkgs/issues/526825
# reported upstream at: https://github.com/musescore/MuseScore/issues/33015
qtdeclarative = super.qtdeclarative.overrideAttrs (
new: old: {
patches = old.patches ++ [
(fetchpatch {
url = "https://github.com/qt/qtdeclarative/commit/9d4d376726a6ce15c429128dc65b927e411e40da.patch";
hash = "sha256-XhfliF5wZuN4/E55f8hfipIRjxBe9V7vL1cgn5p4xqA=";
})
];
}
);
}
);
in
stdenv.mkDerivation (finalAttrs: {
pname = "musescore";
version = "4.7.2";
@@ -94,8 +142,8 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
cmake
kdePackages.qttools
kdePackages.wrapQtAppsHook
kdePackages'.qttools
kdePackages'.wrapQtAppsHook
ninja
pkg-config
]
@@ -108,12 +156,12 @@ stdenv.mkDerivation (finalAttrs: {
buildInputs = [
flac
freetype
kdePackages.qt5compat
kdePackages.qtbase
kdePackages.qtdeclarative
kdePackages.qtnetworkauth
kdePackages.qtscxml
kdePackages.qtsvg
kdePackages'.qt5compat
kdePackages'.qtbase
kdePackages'.qtdeclarative
kdePackages'.qtnetworkauth
kdePackages'.qtscxml
kdePackages'.qtsvg
lame
libjack2
libogg
@@ -130,7 +178,7 @@ stdenv.mkDerivation (finalAttrs: {
]
++ lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib
kdePackages.qtwayland
kdePackages'.qtwayland
];
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''