From b8c9d52b8465cb716a12536fd5e5af16d38d1a36 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Fri, 22 Nov 2024 16:59:55 +0100 Subject: [PATCH 1/3] fire: 1.0.0.3 -> 1.0.1-unstable-2024-10-22 --- .../fire/0001-Remove-FetchContent-usage.patch | 62 ------------ pkgs/applications/audio/fire/default.nix | 95 ++++++++----------- pkgs/top-level/all-packages.nix | 5 +- 3 files changed, 40 insertions(+), 122 deletions(-) delete mode 100644 pkgs/applications/audio/fire/0001-Remove-FetchContent-usage.patch diff --git a/pkgs/applications/audio/fire/0001-Remove-FetchContent-usage.patch b/pkgs/applications/audio/fire/0001-Remove-FetchContent-usage.patch deleted file mode 100644 index 35f4c8252e5e..000000000000 --- a/pkgs/applications/audio/fire/0001-Remove-FetchContent-usage.patch +++ /dev/null @@ -1,62 +0,0 @@ -From fbf2ddd872db6a3640bc7d693356b99be9dd70f5 Mon Sep 17 00:00:00 2001 -From: OPNA2608 -Date: Thu, 18 Aug 2022 20:12:07 +0200 -Subject: [PATCH] Remove FetchContent usage - ---- - CMakeLists.txt | 27 +++++---------------------- - 1 file changed, 5 insertions(+), 22 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 84c66a7..5234903 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -30,20 +30,9 @@ project(Fire VERSION 0.9.9) - # or - # add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE - --include(FetchContent) --FetchContent_Declare( -- JUCE -- GIT_REPOSITORY https://github.com/juce-framework/JUCE.git -- GIT_TAG 7.0.1 --) --FetchContent_MakeAvailable(JUCE) -- --FetchContent_Declare( -- readerwriterqueue -- GIT_REPOSITORY https://github.com/cameron314/readerwriterqueue -- GIT_TAG v1.0.6 --) --FetchContent_MakeAvailable(readerwriterqueue) -+add_subdirectory(JUCE EXCLUDE_FROM_ALL) -+ -+add_subdirectory(readerwriterqueue EXCLUDE_FROM_ALL) - - # If you are building a VST2 or AAX plugin, CMake needs to be told where to find these SDKs on your - # system. This setup should be done before calling `juce_add_plugin`. -@@ -172,13 +161,7 @@ set(TestFiles - test/CatchMain.cpp - test/PluginTest.cpp) - --# Download the tagged version of Catch2 --Include(FetchContent) --FetchContent_Declare( -- Catch2 -- GIT_REPOSITORY https://github.com/catchorg/Catch2.git -- GIT_TAG v2.13.7) --FetchContent_MakeAvailable(Catch2) -+add_subdirectory(Catch2 EXCLUDE_FROM_ALL) - - # Setup the test executable, again C++ 20 please - add_executable(Tests ${TestFiles}) -@@ -199,4 +182,4 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/test PREFIX "" FILES ${TestFiles}) - # We have to manually provide the source directory here for now - # https://github.com/catchorg/Catch2/issues/2026 - include(${Catch2_SOURCE_DIR}/contrib/Catch.cmake) --catch_discover_tests(Tests) -\ No newline at end of file -+catch_discover_tests(Tests) --- -2.36.0 - diff --git a/pkgs/applications/audio/fire/default.nix b/pkgs/applications/audio/fire/default.nix index 5b71667a2af0..3844fe691d2c 100644 --- a/pkgs/applications/audio/fire/default.nix +++ b/pkgs/applications/audio/fire/default.nix @@ -1,9 +1,10 @@ { stdenv , lib , fetchFromGitHub +, unstableGitUpdater +, catch2_3 , cmake , pkg-config -, catch2 , libX11 , libXrandr , libXinerama @@ -11,56 +12,37 @@ , libXcursor , freetype , alsa-lib -, Accelerate -, Cocoa -, WebKit -, CoreServices -, DiscRecording -, CoreAudioKit -, MetalKit -, simd +, apple-sdk_11 }: -let - # FetchContent replacement, check CMakeLists.txt for requested versions (Nixpkgs' Catch2 works) - readerwriterqueue = fetchFromGitHub { - owner = "cameron314"; - repo = "readerwriterqueue"; - rev = "v1.0.6"; - sha256 = "sha256-g7NX7Ucl5GWw3u6TiUOITjhv7492ByTzACtWR0Ph2Jc="; - }; -in stdenv.mkDerivation rec { pname = "fire"; - version = "1.0.0.3"; + version = "1.0.1-unstable-2024-10-22"; src = fetchFromGitHub { owner = "jerryuhoo"; repo = "Fire"; - rev = "v${version}"; + rev = "4c3275caa0dbd9e65c6c3d574cc5ac1c828e529a"; fetchSubmodules = true; - hash = "sha256-X3pzTrNd0G6BouCDkr3dukQTFDzZ7qblIYxFQActKGE="; + hash = "sha256-DyYP/uDawa+m2FtNvEvu36iRl6zfMyGNMMad5f/rX4k="; }; - patches = [ - ./0001-Remove-FetchContent-usage.patch - ]; - postPatch = '' - # 1. Remove hardcoded LTO flags: needs extra setup on Linux, - # possibly broken on Darwin - # 2. Disable automatic copying of built plugins during buildPhase, it defaults - # into user home and we want to have building & installing separated. - sed -i \ - -e '/juce::juce_recommended_lto_flags/d' \ - -e 's/COPY_PLUGIN_AFTER_BUILD TRUE/COPY_PLUGIN_AFTER_BUILD FALSE/g' \ - CMakeLists.txt + # Disable automatic copying of built plugins during buildPhase, it defaults + # into user home and we want to have building & installing separated. + substituteInPlace CMakeLists.txt \ + --replace-fail 'COPY_PLUGIN_AFTER_BUILD TRUE' 'COPY_PLUGIN_AFTER_BUILD FALSE' + '' + lib.optionalString stdenv.hostPlatform.isLinux '' + # Remove hardcoded LTO flags: needs extra setup on Linux + substituteInPlace CMakeLists.txt \ + --replace-fail 'juce::juce_recommended_lto_flags' '# Not forcing LTO' + '' + lib.optionalString (!doCheck) '' + substituteInPlace CMakeLists.txt \ + --replace-fail 'include(Tests)' '# Not building tests' \ + --replace-fail 'include(Benchmarks)' '# Not building benchmark test' ''; - preConfigure = '' - ln -s ${readerwriterqueue} readerwriterqueue - ln -s ${catch2.src} Catch2 - ''; + strictDeps = true; nativeBuildInputs = [ cmake @@ -76,38 +58,39 @@ stdenv.mkDerivation rec { freetype alsa-lib ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - Accelerate - Cocoa - WebKit - CoreServices - DiscRecording - CoreAudioKit - MetalKit - simd + apple-sdk_11 + ]; + + cmakeFlags = [ + (lib.cmakeBool "FETCHCONTENT_FULLY_DISCONNECTED" true) + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_CATCH2" "${catch2_3.src}") ]; installPhase = let - vst3Dir = "${placeholder "out"}/${if stdenv.hostPlatform.isDarwin then "Library/Audio/Plug-Ins/VST3" else "lib/vst3"}"; - auDir = "${placeholder "out"}/Library/Audio/Plug-Ins/Components"; + pathMappings = [ + { from = "LV2"; to = "${placeholder "out"}/${if stdenv.hostPlatform.isDarwin then "Library/Audio/Plug-Ins/LV2" else "lib/lv2"}"; } + { from = "VST3"; to = "${placeholder "out"}/${if stdenv.hostPlatform.isDarwin then "Library/Audio/Plug-Ins/VST3" else "lib/vst3"}"; } + # this one's a guess, don't know where ppl have agreed to put them yet + { from = "CLAP"; to = "${placeholder "out"}/${if stdenv.hostPlatform.isDarwin then "Library/Audio/Plug-Ins/CLAP" else "lib/clap"}"; } + ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ + { from = "AU"; to = "${placeholder "out"}/Library/Audio/Plug-Ins/Components"; } + ]; in '' runHook preInstall - mkdir -p ${vst3Dir} + '' + lib.strings.concatMapStringsSep "\n" (entry: '' + mkdir -p ${entry.to} # Exact path of the build artefact depends on used CMAKE_BUILD_TYPE - cp -R Fire_artefacts/*/VST3/* ${vst3Dir}/ - '' + lib.optionalString stdenv.hostPlatform.isDarwin '' - mkdir -p ${auDir} - cp -R Fire_artefacts/*/AU/* ${auDir}/ - '' + '' + cp -r Fire_artefacts/*/${entry.from}/* ${entry.to}/ + '') pathMappings + '' runHook postInstall ''; - # Fails to find fp.h on its own - env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-isystem ${CoreServices}/Library/Frameworks/CoreServices.framework/Versions/Current/Frameworks/CarbonCore.framework/Versions/Current/Headers/"; - doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + passthru.updateScript = unstableGitUpdater { tagPrefix = "v"; }; + meta = with lib; { description = "Multi-band distortion plugin by Wings"; homepage = "https://github.com/jerryuhoo/Fire"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ece00bdbe358..bfb6c94bdfc4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14055,10 +14055,7 @@ with pkgs; inherit (darwin.apple_sdk_11_0.frameworks) CoreServices Security; }; - fire = darwin.apple_sdk_11_0.callPackage ../applications/audio/fire { - inherit (darwin.apple_sdk_11_0.frameworks) Accelerate Cocoa WebKit CoreServices DiscRecording CoreAudioKit MetalKit; - inherit (darwin.apple_sdk_11_0.libs) simd; - }; + fire = callPackage ../applications/audio/fire { }; buildMozillaMach = opts: callPackage (import ../applications/networking/browsers/firefox/common.nix opts) { }; From f5afe5b4525496503251e0ce51d2eb25f8c001b2 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Fri, 22 Nov 2024 17:01:50 +0100 Subject: [PATCH 2/3] fire: Modernise, nixfmt --- pkgs/applications/audio/fire/default.nix | 156 +++++++++++++---------- 1 file changed, 92 insertions(+), 64 deletions(-) diff --git a/pkgs/applications/audio/fire/default.nix b/pkgs/applications/audio/fire/default.nix index 3844fe691d2c..f8f32d05708f 100644 --- a/pkgs/applications/audio/fire/default.nix +++ b/pkgs/applications/audio/fire/default.nix @@ -1,21 +1,22 @@ -{ stdenv -, lib -, fetchFromGitHub -, unstableGitUpdater -, catch2_3 -, cmake -, pkg-config -, libX11 -, libXrandr -, libXinerama -, libXext -, libXcursor -, freetype -, alsa-lib -, apple-sdk_11 +{ + stdenv, + lib, + fetchFromGitHub, + unstableGitUpdater, + catch2_3, + cmake, + pkg-config, + libX11, + libXrandr, + libXinerama, + libXext, + libXcursor, + freetype, + alsa-lib, + apple-sdk_11, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "fire"; version = "1.0.1-unstable-2024-10-22"; @@ -27,20 +28,23 @@ stdenv.mkDerivation rec { hash = "sha256-DyYP/uDawa+m2FtNvEvu36iRl6zfMyGNMMad5f/rX4k="; }; - postPatch = '' - # Disable automatic copying of built plugins during buildPhase, it defaults - # into user home and we want to have building & installing separated. - substituteInPlace CMakeLists.txt \ - --replace-fail 'COPY_PLUGIN_AFTER_BUILD TRUE' 'COPY_PLUGIN_AFTER_BUILD FALSE' - '' + lib.optionalString stdenv.hostPlatform.isLinux '' - # Remove hardcoded LTO flags: needs extra setup on Linux - substituteInPlace CMakeLists.txt \ - --replace-fail 'juce::juce_recommended_lto_flags' '# Not forcing LTO' - '' + lib.optionalString (!doCheck) '' - substituteInPlace CMakeLists.txt \ - --replace-fail 'include(Tests)' '# Not building tests' \ - --replace-fail 'include(Benchmarks)' '# Not building benchmark test' - ''; + postPatch = + '' + # Disable automatic copying of built plugins during buildPhase, it defaults + # into user home and we want to have building & installing separated. + substituteInPlace CMakeLists.txt \ + --replace-fail 'COPY_PLUGIN_AFTER_BUILD TRUE' 'COPY_PLUGIN_AFTER_BUILD FALSE' + '' + + lib.optionalString stdenv.hostPlatform.isLinux '' + # Remove hardcoded LTO flags: needs extra setup on Linux + substituteInPlace CMakeLists.txt \ + --replace-fail 'juce::juce_recommended_lto_flags' '# Not forcing LTO' + '' + + lib.optionalString (!finalAttrs.finalPackage.doCheck) '' + substituteInPlace CMakeLists.txt \ + --replace-fail 'include(Tests)' '# Not building tests' \ + --replace-fail 'include(Benchmarks)' '# Not building benchmark test' + ''; strictDeps = true; @@ -49,53 +53,77 @@ stdenv.mkDerivation rec { pkg-config ]; - buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ - libX11 - libXrandr - libXinerama - libXext - libXcursor - freetype - alsa-lib - ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - apple-sdk_11 - ]; + buildInputs = + lib.optionals stdenv.hostPlatform.isLinux [ + libX11 + libXrandr + libXinerama + libXext + libXcursor + freetype + alsa-lib + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_11 ]; cmakeFlags = [ (lib.cmakeBool "FETCHCONTENT_FULLY_DISCONNECTED" true) (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_CATCH2" "${catch2_3.src}") ]; - installPhase = let - pathMappings = [ - { from = "LV2"; to = "${placeholder "out"}/${if stdenv.hostPlatform.isDarwin then "Library/Audio/Plug-Ins/LV2" else "lib/lv2"}"; } - { from = "VST3"; to = "${placeholder "out"}/${if stdenv.hostPlatform.isDarwin then "Library/Audio/Plug-Ins/VST3" else "lib/vst3"}"; } - # this one's a guess, don't know where ppl have agreed to put them yet - { from = "CLAP"; to = "${placeholder "out"}/${if stdenv.hostPlatform.isDarwin then "Library/Audio/Plug-Ins/CLAP" else "lib/clap"}"; } - ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - { from = "AU"; to = "${placeholder "out"}/Library/Audio/Plug-Ins/Components"; } - ]; - in '' - runHook preInstall + installPhase = + let + pathMappings = + [ + { + from = "LV2"; + to = "${placeholder "out"}/${ + if stdenv.hostPlatform.isDarwin then "Library/Audio/Plug-Ins/LV2" else "lib/lv2" + }"; + } + { + from = "VST3"; + to = "${placeholder "out"}/${ + if stdenv.hostPlatform.isDarwin then "Library/Audio/Plug-Ins/VST3" else "lib/vst3" + }"; + } + # this one's a guess, don't know where ppl have agreed to put them yet + { + from = "CLAP"; + to = "${placeholder "out"}/${ + if stdenv.hostPlatform.isDarwin then "Library/Audio/Plug-Ins/CLAP" else "lib/clap" + }"; + } + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + { + from = "AU"; + to = "${placeholder "out"}/Library/Audio/Plug-Ins/Components"; + } + ]; + in + '' + runHook preInstall - '' + lib.strings.concatMapStringsSep "\n" (entry: '' - mkdir -p ${entry.to} - # Exact path of the build artefact depends on used CMAKE_BUILD_TYPE - cp -r Fire_artefacts/*/${entry.from}/* ${entry.to}/ - '') pathMappings + '' + '' + + lib.strings.concatMapStringsSep "\n" (entry: '' + mkdir -p ${entry.to} + # Exact path of the build artefact depends on used CMAKE_BUILD_TYPE + cp -r Fire_artefacts/*/${entry.from}/* ${entry.to}/ + '') pathMappings + + '' - runHook postInstall - ''; + runHook postInstall + ''; doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; passthru.updateScript = unstableGitUpdater { tagPrefix = "v"; }; - meta = with lib; { + meta = { description = "Multi-band distortion plugin by Wings"; homepage = "https://github.com/jerryuhoo/Fire"; - license = licenses.agpl3Only; # Not clarified if Only or Plus - platforms = platforms.unix; - maintainers = with maintainers; [ OPNA2608 ]; + license = lib.licenses.agpl3Only; # Not clarified if Only or Plus + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ OPNA2608 ]; }; -} +}) From 652d9def63a53e4e195ae1825bee5afa1f3706a5 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Fri, 22 Nov 2024 17:04:12 +0100 Subject: [PATCH 3/3] fire: Move to pkgs/by-name --- .../audio/fire/default.nix => by-name/fi/fire/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{applications/audio/fire/default.nix => by-name/fi/fire/package.nix} (100%) diff --git a/pkgs/applications/audio/fire/default.nix b/pkgs/by-name/fi/fire/package.nix similarity index 100% rename from pkgs/applications/audio/fire/default.nix rename to pkgs/by-name/fi/fire/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bfb6c94bdfc4..ce92aa853f46 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14055,8 +14055,6 @@ with pkgs; inherit (darwin.apple_sdk_11_0.frameworks) CoreServices Security; }; - fire = callPackage ../applications/audio/fire { }; - buildMozillaMach = opts: callPackage (import ../applications/networking/browsers/firefox/common.nix opts) { }; firefox-unwrapped = import ../applications/networking/browsers/firefox/packages/firefox.nix {