2024-01-25 14:12:00 +00:00
{ lib
, stdenv
, fetchFromGitHub
, ensureNewerSourcesForZipFilesHook
, makeDesktopItem
, imagemagick
, cmake
, pkg-config
, alsa-lib
, freetype
, webkitgtk
, gnome
, curl
, xorg
, python3
, makeWrapper
} :
let
# data copied from build system: https://build.opensuse.org/package/view_file/home:plugdata/plugdata/PlugData.desktop
desktopItem = makeDesktopItem {
name = " P l u g D a t a " ;
desktopName = " P l u g D a t a " ;
exec = " p l u g d a t a " ;
icon = " p l u g d a t a _ l o g o . p n g " ;
comment = " P u r e D a t a a s a p l u g i n , w i t h a n e w G U I " ;
type = " A p p l i c a t i o n " ;
categories = [ " A u d i o V i d e o " " M u s i c " ] ;
} ;
in
stdenv . mkDerivation ( finalAttrs : {
pname = " p l u g d a t a " ;
version = " 0 . 8 . 0 " ;
src = fetchFromGitHub {
owner = " p l u g d a t a - t e a m " ;
repo = " p l u g d a t a " ;
rev = " v ${ finalAttrs . version } " ;
hash = " s h a 2 5 6 - q G 9 f H 5 C 4 2 j i H j 0 3 p / K M 2 8 j m D I k J k r Q M e 7 f x g 9 2 L g 7 B 4 = " ;
fetchSubmodules = true ;
} ;
nativeBuildInputs = [
cmake
pkg-config
ensureNewerSourcesForZipFilesHook
imagemagick
python3
makeWrapper
] ;
buildInputs = [
alsa-lib
curl
freetype
webkitgtk
xorg . libX11
xorg . libXcursor
xorg . libXext
xorg . libXinerama
xorg . libXrender
xorg . libXrandr
] ;
# Standard fix for JUCE programs: https://github.com/NixOS/nixpkgs/blob/5014727e62ae7b22fb1afc61d789ca6ad9170435/pkgs/applications/audio/bespokesynth/default.nix#L137
env . NIX_LDFLAGS = lib . optionalString stdenv . hostPlatform . isLinux " - r p a t h ${ lib . makeLibraryPath ( [
xorg . libX11
xorg . libXrandr
xorg . libXinerama
xorg . libXext
xorg . libXcursor
xorg . libXrender
] ) } " ;
dontPatchELF = true ; # needed or nix will try to optimize the binary by removing "useless" rpath
postPatch = ''
# Don't build LV2 plugin (it hangs), and don't automatically install
sed - i ' s / LV2 / /g ' CMakeLists . txt
'' ;
installPhase = ''
runHook preInstall
cd . . # build artifacts are placed inside the source directory for some reason
mkdir - p $ out / { bin , lib / { clap , vst3 } }
cp Plugins/Standalone/plugdata $ out/bin
cp - r Plugins/CLAP/plugdata { , - fx } . clap $ out/lib/clap
cp - r Plugins/VST3/plugdata { , - fx } . vst3 $ out/lib/vst3
icon_name = " p l u g d a t a _ l o g o . p n g "
icon_path = " R e s o u r c e s / I c o n s / $ i c o n _ n a m e "
install - m644 - D " ${ desktopItem } " /share/applications /* - t $ o u t / s h a r e / a p p l i c a t i o n s
for size in 16 24 32 48 64 128 256 512 ; do
mkdir - p $ out/share/icons/hicolor / " $ s i z e " x " $ s i z e " /apps
convert - resize " $ s i z e " x " $ s i z e " " $ i c o n _ p a t h " $ out/share/icons/hicolor / " $ s i z e " x " $ s i z e " /apps / " $ i c o n _ n a m e "
done
runHook postInstall
'' ;
postInstall = ''
# Ensure zenity is available, or it won't be able to open new files.
# These X11 libs get dlopen'd, they cause visual bugs when unavailable.
wrapProgram $ out/bin/plugdata \
- - prefix PATH : ' $ { lib . makeBinPath [
gnome . zenity
] } ' \
- - prefix LD_LIBRARY_PATH : ' $ { lib . makeLibraryPath [
xorg . libXrandr
xorg . libXinerama
xorg . libXcursor
xorg . libXrender
] } '
'' ;
meta = with lib ; {
description = " P l u g i n w r a p p e r a r o u n d P u r e D a t a t o a l l o w p a t c h i n g i n a w i d e s e l e c t i o n o f D A W s " ;
2024-04-21 15:54:59 +00:00
mainProgram = " p l u g d a t a " ;
2024-01-25 14:12:00 +00:00
homepage = " h t t p s : / / p l u g d a t a . o r g / " ;
license = licenses . gpl3 ;
platforms = platforms . linux ;
maintainers = with maintainers ; [ PowerUser64 ] ;
} ;
} )