From 3b2c934393f9b887b071a21bb17101cd0b2c80af Mon Sep 17 00:00:00 2001 From: sterni Date: Tue, 1 Dec 2026 08:44:20 +0100 Subject: [PATCH] haskellPackages.PortMidi: stop using vendored lib, drop obsolete patches PortMidi-0.2.0.1 has support for linking against portmidi via pkg-config instead of using the vendored (outdated) version. This allows us to drop all patches. (cherry picked from commit 5fca0e7614cf6b35a3614c5c9b116d67af4edeea) --- .../haskell-modules/configuration-common.nix | 19 ------------ .../haskell-modules/configuration-nix.nix | 10 ++++++ .../patches/portmidi-alsa-plugins.patch | 31 ------------------- 3 files changed, 10 insertions(+), 50 deletions(-) delete mode 100644 pkgs/development/haskell-modules/patches/portmidi-alsa-plugins.patch diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index cffc8d3de758..7e4840d703b8 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1397,25 +1397,6 @@ with haskellLib; gargoyle-postgresql-nix = addBuildTool pkgs.postgresql super.gargoyle-postgresql-nix; - # PortMidi needs an environment variable to have ALSA find its plugins: - # https://github.com/NixOS/nixpkgs/issues/6860 - PortMidi = overrideCabal (drv: { - patches = (drv.patches or [ ]) ++ [ - ./patches/portmidi-alsa-plugins.patch - # Fixes compilation with GCC15 which defaults to C23 - # https://github.com/PortMidi/PortMidi-haskell/pull/24 - (pkgs.fetchpatch { - name = "PortMidi-C23.patch"; - url = "https://github.com/PortMidi/PortMidi-haskell/commit/24b6ce1c77137b055ae57a99080d5f1616490197.patch"; - sha256 = "sha256-PqnWA/DMW00Gtfa4YDV6iC/MXwQ3gFsNESbx+daw4C4="; - }) - ]; - postPatch = (drv.postPatch or "") + '' - substituteInPlace portmidi/pm_linux/pmlinuxalsa.c \ - --replace @alsa_plugin_dir@ "${pkgs.alsa-plugins}/lib/alsa-lib" - ''; - }) super.PortMidi; - scat = overrideCabal (drv: { patches = [ # Fix build with base >= 4.11 (https://github.com/redelmann/scat/pull/6) diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index fb7e4338a4c5..bafa8878e0f4 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -2196,6 +2196,16 @@ builtins.intersectAttrs super { libremidi ; + # Prefer using pkg-config to find system libs + PortMidi = lib.pipe super.PortMidi [ + (disableCabalFlag "vendoredC") + # Use pkg-config + (enableCabalFlag "pkgConfig") + (overrideCabal (drv: { + libraryPkgconfigDepends = drv.libraryPkgconfigDepends or [ ] ++ drv.librarySystemDepends; + })) + ]; + webkit2gtk3-javascriptcore = lib.pipe super.webkit2gtk3-javascriptcore [ (addBuildDepend pkgs.libxtst) (addBuildDepend pkgs.lerc) diff --git a/pkgs/development/haskell-modules/patches/portmidi-alsa-plugins.patch b/pkgs/development/haskell-modules/patches/portmidi-alsa-plugins.patch deleted file mode 100644 index 13860b7cfb7f..000000000000 --- a/pkgs/development/haskell-modules/patches/portmidi-alsa-plugins.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff -Naurd PortMidi-0.2.0.0/portmidi/pm_linux/pmlinuxalsa.c PortMidi-0.2.0.0-alsafix/portmidi/pm_linux/pmlinuxalsa.c ---- PortMidi-0.2.0.0/portmidi/pm_linux/pmlinuxalsa.c 2023-12-13 11:35:12.517413022 +0000 -+++ PortMidi-0.2.0.0-alsafix/portmidi/pm_linux/pmlinuxalsa.c 2023-12-13 11:35:12.565413037 +0000 -@@ -719,6 +719,18 @@ - } - - -+static void set_alsa_plugin_path( void ) -+{ -+ char *existing; -+ -+ existing = getenv("ALSA_PLUGIN_DIR"); -+ if (NULL != existing) { -+ return; -+ } -+ setenv("ALSA_PLUGIN_DIR", "@alsa_plugin_dir@", 0); -+} -+ -+ - PmError pm_linuxalsa_init( void ) - { - int err; -@@ -726,6 +738,8 @@ - snd_seq_port_info_t *pinfo; - unsigned int caps; - -+ set_alsa_plugin_path(); -+ - /* Previously, the last parameter was SND_SEQ_NONBLOCK, but this - * would cause messages to be dropped if the ALSA buffer fills up. - * The correct behavior is for writes to block until there is