Files
thomas-likes-nix-pkgs/modules/pkgs/ocenaudio.nix
T
2026-04-15 13:36:01 +01:00

86 lines
2.8 KiB
Nix

{lib, ...}: {
perSystem = {pkgs, ...}: let
pname = "ocenaudio";
version = "3.17.3";
in {
packages.ocenaudio = pkgs.stdenv.mkDerivation {
inherit pname version;
src = pkgs.fetchurl {
name = "ocenaudio.deb";
url = "https://www.ocenaudio.com/downloads/index.php/ocenaudio_debian12.deb?version=v${version}";
hash = "sha256-NqQLYeX+QRXmZfFMmpuGc1EHm6IZMUJNY0/WiBnNdCw=";
};
nativeBuildInputs = [
pkgs.autoPatchelfHook
pkgs.qt6.wrapQtAppsHook
pkgs.dpkg
pkgs.patchelf
];
buildInputs = [
pkgs.xz
pkgs.qt6.qtbase
pkgs.bzip2
pkgs.libjack2
pkgs.alsa-lib
pkgs.libpulseaudio
];
dontBuild = true;
dontStrip = true;
unpackPhase = ''
runHook preUnpack
${pkgs.dpkg}/bin/dpkg-deb -x $src .
runHook postUnpack
'';
installPhase = ''
runHook preInstall
cp -r opt/ocenaudio $out
cp -r usr/share $out/share
substituteInPlace $out/share/applications/ocenaudio.desktop \
--replace-fail "/opt/ocenaudio/bin/ocenaudio" "ocenaudio"
mkdir -p $out/share/licenses/ocenaudio
mv $out/bin/ocenaudio_license.txt $out/share/licenses/ocenaudio/LICENSE
ln -s ${pkgs.bzip2.out}/lib/libbz2.so.1 $out/lib/libbz2.so.1.0
# Upstream currently ships a demucs plugin that can depend on older sonames
# than the bundled core libraries. Rewrite those NEEDED entries to whichever
# bundled libqtocen* versions are actually present before autoPatchelf runs.
demucs_lib=$(find $out/lib -maxdepth 1 -name 'libqtocendemucs.so*' | head -n1 || true)
if [ -n "$demucs_lib" ]; then
actual_qtocenai=$(find $out/lib -maxdepth 1 -name 'libqtocenai.so.*' | sort -V | tail -n1 || true)
actual_qtocencore=$(find $out/lib -maxdepth 1 -name 'libqtocencore.so.*' | sort -V | tail -n1 || true)
if [ -n "$actual_qtocenai" ]; then
${pkgs.patchelf}/bin/patchelf \
--replace-needed libqtocenai.so.3.15 "$(basename "$actual_qtocenai")" \
"$demucs_lib" || true
fi
if [ -n "$actual_qtocencore" ]; then
${pkgs.patchelf}/bin/patchelf \
--replace-needed libqtocencore.so.3.15 "$(basename "$actual_qtocencore")" \
"$demucs_lib" || true
fi
fi
runHook postInstall
'';
passthru.updateScript = ../../.gitea/scripts/update-ocenaudio-nix.sh;
meta = {
description = "Cross-platform, easy to use, fast and functional audio editor";
homepage = "https://www.ocenaudio.com";
sourceProvenance = with lib.sourceTypes; [binaryNativeCode];
platforms = ["x86_64-linux"];
};
};
};
}