From 28db7596a94189783a944d5cacae62f110703697 Mon Sep 17 00:00:00 2001 From: Niklas Korz Date: Wed, 2 Jul 2025 21:34:50 +0200 Subject: [PATCH 1/3] tenacity: remove `rec` and `with lib;` --- pkgs/by-name/te/tenacity/package.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/te/tenacity/package.nix b/pkgs/by-name/te/tenacity/package.nix index bed63fd78f6a..509290301648 100644 --- a/pkgs/by-name/te/tenacity/package.nix +++ b/pkgs/by-name/te/tenacity/package.nix @@ -47,7 +47,7 @@ util-linux, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "tenacity"; version = "1.3.4"; @@ -56,7 +56,7 @@ stdenv.mkDerivation rec { owner = "tenacityteam"; repo = "tenacity"; fetchSubmodules = true; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-2gndOwgEJK2zDSbjcZigbhEpGv301/ygrf+EQhKp8PI="; }; @@ -151,12 +151,12 @@ stdenv.mkDerivation rec { "-DCMAKE_SKIP_BUILD_RPATH=ON" ]; - meta = with lib; { + meta = { description = "Sound editor with graphical UI"; mainProgram = "tenacity"; homepage = "https://tenacityaudio.org/"; - license = licenses.gpl2Plus; - maintainers = with maintainers; [ irenes ]; - platforms = platforms.linux; + license = lib.licenses.gpl2Plus; + maintainers = with lib.maintainers; [ irenes ]; + platforms = lib.platforms.linux; }; -} +}) From 68c50246016d14ed2aa21d6744ef39229494cbee Mon Sep 17 00:00:00 2001 From: Niklas Korz Date: Wed, 2 Jul 2025 21:36:00 +0200 Subject: [PATCH 2/3] tenacity: add darwin support --- pkgs/by-name/te/tenacity/package.nix | 60 +++++++++++++++++++++------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/pkgs/by-name/te/tenacity/package.nix b/pkgs/by-name/te/tenacity/package.nix index 509290301648..31fb7c07b743 100644 --- a/pkgs/by-name/te/tenacity/package.nix +++ b/pkgs/by-name/te/tenacity/package.nix @@ -3,6 +3,7 @@ lib, fetchFromGitea, cmake, + ninja, wxGTK32, gtk3, pkg-config, @@ -60,16 +61,42 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-2gndOwgEJK2zDSbjcZigbhEpGv301/ygrf+EQhKp8PI="; }; - postPatch = '' - mkdir -p build/src/private - touch build/src/private/RevisionIdent.h + postPatch = + '' + # GIT_DESCRIBE is used for the version string and can't be passed in + # as an option, so we substitute it instead. + substituteInPlace CMakeLists.txt \ + --replace-fail 'set( GIT_DESCRIBE "unknown" )' 'set( GIT_DESCRIBE "${finalAttrs.version}" )' + '' + + lib.optionalString stdenv.hostPlatform.isLinux '' + substituteInPlace libraries/lib-files/FileNames.cpp \ + --replace-fail /usr/include/linux/magic.h ${linuxHeaders}/include/linux/magic.h + '' + + lib.optionalString stdenv.hostPlatform.isDarwin '' + # Tenacity has special handling for ffmpeg library search on darwin, + # looking only in a few specific directories. + # Make sure it searches for our version of ffmpeg in the nix store. + substituteInPlace libraries/lib-ffmpeg-support/FFmpegFunctions.cpp \ + --replace-fail /usr/local/lib/tenacity ${lib.getLib ffmpeg}/lib + ''; - substituteInPlace libraries/lib-files/FileNames.cpp \ - --replace /usr/include/linux/magic.h \ - ${linuxHeaders}/include/linux/magic.h + postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' + mkdir $out/{bin,Applications} + mv $out/{,Applications/}Tenacity.app + + # Symlinking the binary is insufficient as it would be unable to + # find the bundle resources + cat << EOF > "$out/bin/tenacity" + #!${stdenv.shell} + open -na "$out/Applications/Tenacity.app" --args "\$@" + EOF + chmod +x "$out/bin/tenacity" + + # Only contains a static library that is already linked into the tenacity binary + rm -r $out/lib ''; - postFixup = '' + postFixup = lib.optionalString stdenv.hostPlatform.isLinux '' wrapProgram "$out/bin/tenacity" \ --suffix AUDACITY_PATH : "$out/share/tenacity" \ --suffix AUDACITY_MODULES_PATH : "$out/lib/tenacity/modules" \ @@ -77,10 +104,9 @@ stdenv.mkDerivation (finalAttrs: { --prefix XDG_DATA_DIRS : "$out/share:$GSETTINGS_SCHEMAS_PATH" ''; - env.NIX_CFLAGS_COMPILE = "-D GIT_DESCRIBE=\"\""; - - # tenacity only looks for ffmpeg at runtime, so we need to link it in manually - NIX_LDFLAGS = toString [ + # Tenacity only looks for ffmpeg at runtime, so we need to link it in manually. + # On darwin, these are ignored by the ffmpeg search even when linked. + NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isLinux (toString [ "-lavcodec" "-lavdevice" "-lavfilter" @@ -89,23 +115,23 @@ stdenv.mkDerivation (finalAttrs: { "-lpostproc" "-lswresample" "-lswscale" - ]; + ]); nativeBuildInputs = [ cmake + ninja gettext - makeWrapper pkg-config python3 ] ++ lib.optionals stdenv.hostPlatform.isLinux [ + makeWrapper linuxHeaders ]; buildInputs = [ - alsa-lib expat ffmpeg file @@ -134,6 +160,7 @@ stdenv.mkDerivation (finalAttrs: { gtk3 ] ++ lib.optionals stdenv.hostPlatform.isLinux [ + alsa-lib at-spi2-core dbus libepoxy @@ -149,6 +176,9 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ # RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/ "-DCMAKE_SKIP_BUILD_RPATH=ON" + # Disabled by default on Linux but enabled on Darwin, so we disable it explicitly for all platforms, + # as we provide dependencies from nixpkgs regardless of the target platform. + "-DVCPKG=OFF" ]; meta = { @@ -157,6 +187,6 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://tenacityaudio.org/"; license = lib.licenses.gpl2Plus; maintainers = with lib.maintainers; [ irenes ]; - platforms = lib.platforms.linux; + platforms = lib.platforms.unix; }; }) From aa1f0203701ad325009ff082f8d9958d0ba4b1ec Mon Sep 17 00:00:00 2001 From: Niklas Korz Date: Wed, 2 Jul 2025 22:08:47 +0200 Subject: [PATCH 3/3] tenacity: add maintainer niklaskorz --- pkgs/by-name/te/tenacity/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/te/tenacity/package.nix b/pkgs/by-name/te/tenacity/package.nix index 31fb7c07b743..b00c4655146f 100644 --- a/pkgs/by-name/te/tenacity/package.nix +++ b/pkgs/by-name/te/tenacity/package.nix @@ -186,7 +186,10 @@ stdenv.mkDerivation (finalAttrs: { mainProgram = "tenacity"; homepage = "https://tenacityaudio.org/"; license = lib.licenses.gpl2Plus; - maintainers = with lib.maintainers; [ irenes ]; + maintainers = with lib.maintainers; [ + irenes + niklaskorz + ]; platforms = lib.platforms.unix; }; })