From 1ebd0f5a5c3914dec43d48d4c53fb012eb6aa5a0 Mon Sep 17 00:00:00 2001 From: Guy Chronister Date: Mon, 31 Mar 2025 09:33:58 -0500 Subject: [PATCH] fluidsynth: Migrate to by-name. fluidsynth: Add conditionals to provide default values on darwin Simplify package.nix Format to RFC style. Apply suggestions from code review Co-authored-by: Pol Dellaiera Fix nix file fluidsynth: update meta attributes to use lib fluidsynth: simplify derivation definition fluidsynth: refactor derivation to use final attributes for versioning fluidsynth: Update meta attribute structure Update pkgs/by-name/fl/fluidsynth/package.nix Co-authored-by: Pol Dellaiera Add license. Co-authored-by: Pol Dellaiera --- .../applications/audio/fluidsynth/default.nix | 37 ---------- pkgs/by-name/fl/fluidsynth/package.nix | 72 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 -- 3 files changed, 72 insertions(+), 41 deletions(-) delete mode 100644 pkgs/applications/audio/fluidsynth/default.nix create mode 100644 pkgs/by-name/fl/fluidsynth/package.nix diff --git a/pkgs/applications/audio/fluidsynth/default.nix b/pkgs/applications/audio/fluidsynth/default.nix deleted file mode 100644 index f0aab08ffb7f..000000000000 --- a/pkgs/applications/audio/fluidsynth/default.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ stdenv, lib, fetchFromGitHub, buildPackages, pkg-config, cmake -, alsa-lib, glib, libjack2, libsndfile, libpulseaudio -, AppKit, AudioUnit, CoreAudio, CoreMIDI, CoreServices -}: - -stdenv.mkDerivation rec { - pname = "fluidsynth"; - version = "2.4.3"; - - src = fetchFromGitHub { - owner = "FluidSynth"; - repo = "fluidsynth"; - rev = "v${version}"; - hash = "sha256-LaJcWrHgt/RzlDQmpzOjF/9ugD5d+8XWRt7pU3SM5Rk="; - }; - - outputs = [ "out" "dev" "man" ]; - - nativeBuildInputs = [ buildPackages.stdenv.cc pkg-config cmake ]; - - buildInputs = [ glib libsndfile libjack2 ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ alsa-lib libpulseaudio ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ AppKit AudioUnit CoreAudio CoreMIDI CoreServices ]; - - cmakeFlags = [ - "-Denable-framework=off" - ]; - - meta = with lib; { - description = "Real-time software synthesizer based on the SoundFont 2 specifications"; - homepage = "https://www.fluidsynth.org"; - license = licenses.lgpl21Plus; - maintainers = with maintainers; [ lovek323 ]; - platforms = platforms.unix; - mainProgram = "fluidsynth"; - }; -} diff --git a/pkgs/by-name/fl/fluidsynth/package.nix b/pkgs/by-name/fl/fluidsynth/package.nix new file mode 100644 index 000000000000..ac8e3b578bc6 --- /dev/null +++ b/pkgs/by-name/fl/fluidsynth/package.nix @@ -0,0 +1,72 @@ +{ + stdenv, + darwin, + lib, + fetchFromGitHub, + buildPackages, + pkg-config, + cmake, + alsa-lib, + glib, + libjack2, + libsndfile, + libpulseaudio, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "fluidsynth"; + version = "2.4.3"; + + src = fetchFromGitHub { + owner = "FluidSynth"; + repo = "fluidsynth"; + tag = "v${finalAttrs.version}"; + hash = "sha256-LaJcWrHgt/RzlDQmpzOjF/9ugD5d+8XWRt7pU3SM5Rk="; + }; + + outputs = [ + "out" + "dev" + "man" + ]; + + nativeBuildInputs = [ + buildPackages.stdenv.cc + pkg-config + cmake + ]; + + buildInputs = + [ + glib + libsndfile + libjack2 + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + alsa-lib + libpulseaudio + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin ( + with darwin.apple_sdk.frameworks; + [ + AppKit + AudioUnit + CoreAudio + CoreMIDI + CoreServices + ] + ); + + cmakeFlags = [ + "-Denable-framework=off" + ]; + + meta = { + description = "Real-time software synthesizer based on the SoundFont 2 specifications"; + homepage = "https://www.fluidsynth.org"; + license = lib.licenses.lgpl21Plus; + maintainers = with lib.maintainers; [ lovek323 ]; + platforms = lib.platforms.unix; + mainProgram = "fluidsynth"; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 30280ebb977d..8f7ddec2449a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12908,10 +12908,6 @@ with pkgs; hamlib = hamlib_4; }; - fluidsynth = callPackage ../applications/audio/fluidsynth { - inherit (darwin.apple_sdk.frameworks) AppKit AudioUnit CoreAudio CoreMIDI CoreServices; - }; - fmit = libsForQt5.callPackage ../applications/audio/fmit { }; fnc = darwin.apple_sdk_11_0.callPackage ../applications/version-management/fnc { };