Files
Radium_Nix/package.nix
T
2026-01-12 20:33:47 +01:00

250 lines
5.7 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{ lib
, stdenv
, fetchFromGitHub
, fetchurl
, fetchzip
, pkg-config
, bash
, coreutils
, which
, guile
, cmake
, doxygen
, git
, python311
, qt5
, libGLU
, alsa-lib
, jack2
, libsamplerate
, lrdf
, libsndfile
, ladspaH
, ladspaPlugins
, glib
, calf
, binutils-unwrapped
, libiberty
, tk-8_5
, libogg
, libvorbis
, speex
, fftw
, fftwFloat
, libxkbfile
, util-macros
, libxrandr
, llvm
, boost
, openssl
, ncurses
, libxcb-util
, gmp
, mpfr
, libmpc
, libpthread-stubs
, liblo
, util-linux
, xorg
, writeShellScriptBin
, useQwebengine ? true
, fullVersion ? false
}:
let
qt-web = if useQwebengine then qt5.qtwebengine else qt5.qtwebkit;
# Static binutils is required by Radium, specifically `libbfd.a'.
binutils-static = binutils-unwrapped.override { enableShared = false; };
# Needs to be an older version.
xcbproto-1_13 = xorg.xcbproto.overrideAttrs (old: {
version = "1.13";
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ python311 ];
preConfigure = ''
export PYTHON=${python311}/bin/python3
export PATH=${python311}/bin:$PATH
'';
src = fetchurl {
url = "https://xcb.freedesktop.org/dist/xcb-proto-1.13.tar.gz";
sha256 = "sha256-Bpjo9ZbkwNutcdPcdU2V6w7btC31Rk4PeCYhIW+jO6c=";
};
});
in stdenv.mkDerivation rec {
pname = "radium";
version = "7.5.76";
src = fetchFromGitHub {
owner = "kmatheussen";
repo = "radium";
rev = "${version}";
sha256 = "sha256-Eiil17cbCraXF3vY2LUy2B6eyfc1XD4JHJWZUfai+wc=";
};
vst2Sdk = fetchzip {
url = "https://web.archive.org/web/20161002042955if_/http://www.steinberg.net/sdk_downloads/vst_sdk2_4_rev2.zip";
sha256 = "sha256-6eDJYGfuVczOTaZNUYa/dLEoCzl6Ysi1I1NrxuN2mPQ=";
};
nativeBuildInputs = [
pkg-config
bash
coreutils
which
guile
cmake
doxygen
git
qt5.wrapQtAppsHook
(writeShellScriptBin "arch" "#!/usr/bin/env sh\nuname -m")
];
buildInputs = [
qt5.qtbase
qt5.qttools
qt5.qtx11extras
qt-web
# In the order of the README.
libGLU
alsa-lib
jack2
libsamplerate
lrdf
libsndfile
ladspaH
glib
calf
binutils-static
libiberty
tk-8_5
libogg
libvorbis
speex
fftw
fftwFloat
libxkbfile
util-macros
libxrandr
llvm
boost
openssl
ncurses
libxcb-util
gmp
mpfr
libmpc
xorg.libXinerama
xorg.libXau
xcbproto-1_13
libpthread-stubs
liblo
util-linux # For libuuid
ladspaPlugins
];
patches = [
./qt_paths.patch
./qwebengine_quirks.patch
./build_system_fixes.patch
];
postPatch = ''
patchShebangs .
substituteInPlace Makefile.Qt \
--replace-fail "/usr/bin/env" "${coreutils}/bin/env"
# Next culprit: Python 2.7. Fucking janky build system.
substituteInPlace bin/packages/build_python27.sh \
--replace-fail "CC=clang" "CC=${stdenv.cc}/bin/cc" \
--replace-fail "CXX=clang++" "CXX=${stdenv.cc}/bin/c++"
# This is so Faust can build with LLVM > 18.
cp ${./faust_llvm_21.patch} bin/packages/faust_llvm_21.patch
'';
configurePhase = ":";
env = {
# If false, build the demo version.
FULL_VERSION = fullVersion;
BUILDTYPE = "RELEASE";
USE_QWEBENGINE = useQwebengine;
# Recommended in `configuration.sh'.
WARNINGS_AS_ERRORS = false;
# If running on an AMD GPU, this is required.
INCLUDE_FAUSTDEV_BUT_NOT_LLVM = true;
LLVM_PATH = "${llvm.dev}";
UIC = "${qt5.qtbase.dev}/bin/uic";
MOC = "${qt5.qtbase.dev}/bin/moc";
QT_UI_CFLAGS =
"-I${qt5.qttools.dev}/include/QtUiTools";
RADIUM_BFD_LDFLAGS =
"-L${binutils-static.lib}/lib -lbfd -lsframe";
RADIUM_VST2SDK_PATH = "${vst2Sdk}";
};
qtWrapperArgs = [
# Does not launch with custom Qt paths otherwise.
"--set OVERRIDE_RADIUM_QPA 1"
# This is what `run_radium_linux.sh' does.
"--prefix LD_LIBRARY_PATH : ${placeholder "out"}/opt/radium/packages/python27_install/lib"
"--prefix LD_LIBRARY_PATH : ${placeholder "out"}/opt/radium/packages/faust/build/lib"
# No access to `libqxcb.so' otherwise.
"--prefix QT_PLUGIN_PATH : ${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins"
"--prefix QT_QPA_PLATFORM_PLUGIN_PATH : ${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins/platforms"
];
buildPhase = ''
make packages
chmod +x ./build_linux.sh
./build_linux.sh -j$(nproc)
'';
installPhase = ''
mkdir -p $out/{opt,bin,share/applications,share/icons}
chmod +x ./install.sh
./install.sh $out/opt
ln -s $out/opt/radium/radium_linux.bin $out/bin/radium
cp bin/graphics/radium_logo_256x256_colorized.png $out/share/icons/radium.png
cp $out/opt/radium/radium.desktop $out/share/applications/radium.desktop
'';
preFixup = ''
rm -f $out/opt/radium/ladspa # broken relative symlink
ln -s ${ladspaPlugins}/lib/ladspa $out/opt/radium/ladspa # working
'';
postFixup = ''
wrapQtApp $out/opt/radium/radium_check_opengl
wrapQtApp $out/opt/radium/radium_check_jack_status
wrapQtApp $out/opt/radium/radium_plugin_scanner
wrapQtApp $out/opt/radium/radium_error_message
wrapQtApp $out/opt/radium/radium_progress_window
'';
meta = with lib; {
description = "Radium – a graphical music editor / tracker (DAW)";
homepage = "https://users.notam02.no/~kjetism/radium/";
# Radium in itself is GPLv2. However, the ancient VST2 SDK is
# proprietary.
license = with licenses; [ gpl2 unfree ];
maintainers = with maintainers; [ eko5z ];
platforms = with platforms; gnu ++ linux ++ darwin;
};
}