Merge pull request #147011 from lilyinstarlight/feature/supercollider-plugins

main
Sandro 2 years ago committed by GitHub
commit 581b9541be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      maintainers/maintainer-list.nix
  2. 49
      pkgs/development/interpreters/supercollider/default.nix
  3. 33
      pkgs/development/interpreters/supercollider/plugins/sc3-plugins.nix
  4. 65
      pkgs/development/interpreters/supercollider/supercollider-3.12.0-env-dirs.patch
  5. 18
      pkgs/development/interpreters/supercollider/wrapper.nix
  6. 14
      pkgs/top-level/all-packages.nix

@ -7190,6 +7190,13 @@
githubId = 714;
name = "Lily Ballard";
};
lilyinstarlight = {
email = "lily@lily.flowers";
matrix = "@lily:lily.flowers";
github = "lilyinstarlight";
githubId = 298109;
name = "Lily Foster";
};
limeytexan = {
email = "limeytexan@gmail.com";
github = "limeytexan";

@ -1,12 +1,11 @@
{ lib, stdenv, mkDerivation, fetchurl, cmake, pkg-config, alsa-lib
, libjack2, libsndfile, fftw, curl, gcc
, libXt, qtbase, qttools, qtwebengine
{ lib, stdenv, mkDerivation, fetchurl, cmake
, pkg-config, alsa-lib, libjack2, libsndfile, fftw
, curl, gcc, libXt, qtbase, qttools, qtwebengine
, readline, qtwebsockets, useSCEL ? false, emacs
, supercollider-with-plugins, supercolliderPlugins
, writeText, runCommand
}:
let
inherit (lib) optional;
in
mkDerivation rec {
pname = "supercollider";
version = "3.12.2";
@ -16,6 +15,17 @@ mkDerivation rec {
sha256 = "sha256-1QYorCgSwBK+SVAm4k7HZirr1j+znPmVicFmJdvO3g4=";
};
patches = [
# add support for SC_DATA_DIR and SC_PLUGIN_DIR env vars to override compile-time values
./supercollider-3.12.0-env-dirs.patch
];
nativeBuildInputs = [ cmake pkg-config qttools ];
buildInputs = [ gcc libjack2 libsndfile fftw curl libXt qtbase qtwebengine qtwebsockets readline ]
++ lib.optional (!stdenv.isDarwin) alsa-lib
++ lib.optional useSCEL emacs;
hardeningDisable = [ "stackprotector" ];
cmakeFlags = [
@ -23,17 +33,30 @@ mkDerivation rec {
"-DSC_EL=${if useSCEL then "ON" else "OFF"}"
];
nativeBuildInputs = [ cmake pkg-config qttools ];
buildInputs = [
gcc libjack2 libsndfile fftw curl libXt qtbase qtwebengine qtwebsockets readline ]
++ optional (!stdenv.isDarwin) alsa-lib
++ optional useSCEL emacs;
passthru.tests = {
# test to make sure sclang runs and included plugins are successfully found
sclang-sc3-plugins = let
supercollider-with-test-plugins = supercollider-with-plugins.override {
plugins = with supercolliderPlugins; [ sc3-plugins ];
};
testsc = writeText "test.sc" ''
var err = 0;
try {
MdaPiano.name.postln;
} {
err = 1;
};
err.exit;
'';
in runCommand "sclang-sc3-plugins-test" {} ''
timeout 60s env XDG_CONFIG_HOME="$(mktemp -d)" QT_QPA_PLATFORM=minimal ${supercollider-with-test-plugins}/bin/sclang ${testsc} >$out
'';
};
meta = with lib; {
description = "Programming language for real time audio synthesis";
homepage = "https://supercollider.github.io";
maintainers = with maintainers; [ mrmebelman ];
maintainers = with maintainers; [ lilyinstarlight ];
license = licenses.gpl3Plus;
platforms = platforms.linux;
};

@ -0,0 +1,33 @@
{ stdenv, lib, fetchurl, cmake, supercollider, fftw }:
stdenv.mkDerivation rec {
pname = "sc3-plugins";
version = "3.11.1";
src = fetchurl {
url = "https://github.com/supercollider/sc3-plugins/releases/download/Version-${version}/sc3-plugins-${version}-Source.tar.bz2";
sha256 = "sha256-JjUmu7PJ+x3yRibr+Av2gTREng51fPo7Rk+B4y2JvkQ=";
};
nativeBuildInputs = [ cmake ];
buildInputs = [
supercollider
fftw
];
cmakeFlags = [
"-DSC_PATH=${supercollider}/include/SuperCollider"
"-DSUPERNOVA=ON"
];
stripDebugList = [ "lib" "share" ];
meta = with lib; {
description = "Community plugins for SuperCollider";
homepage = "https://supercollider.github.io/sc3-plugins/";
maintainers = with maintainers; [ lilyinstarlight ];
license = licenses.gpl2Plus;
platforms = platforms.linux;
};
}

@ -0,0 +1,65 @@
diff --git a/common/SC_Filesystem_unix.cpp b/common/SC_Filesystem_unix.cpp
index 52dc1fd2d..aae09ed9c 100644
--- a/common/SC_Filesystem_unix.cpp
+++ b/common/SC_Filesystem_unix.cpp
@@ -94,6 +94,10 @@ bool SC_Filesystem::isNonHostPlatformDirectoryName(const std::string& s) {
}
Path SC_Filesystem::defaultSystemAppSupportDirectory() {
+ const char* sc_data_dir = getenv("SC_DATA_DIR");
+ if (sc_data_dir)
+ return Path(sc_data_dir);
+
# ifdef SC_DATA_DIR
return Path(SC_DATA_DIR);
# else
@@ -125,6 +129,10 @@ Path SC_Filesystem::defaultUserConfigDirectory() {
}
Path SC_Filesystem::defaultResourceDirectory() {
+ const char* sc_data_dir = getenv("SC_DATA_DIR");
+ if (sc_data_dir)
+ return Path(sc_data_dir);
+
# ifdef SC_DATA_DIR
return Path(SC_DATA_DIR);
# else
diff --git a/server/scsynth/SC_Lib_Cintf.cpp b/server/scsynth/SC_Lib_Cintf.cpp
index f6219307e..28e13eb98 100644
--- a/server/scsynth/SC_Lib_Cintf.cpp
+++ b/server/scsynth/SC_Lib_Cintf.cpp
@@ -178,9 +178,13 @@ void initialize_library(const char* uGensPluginPath) {
using DirName = SC_Filesystem::DirName;
if (loadUGensExtDirs) {
+ const char* sc_plugin_dir = getenv("SC_PLUGIN_DIR");
+ if (sc_plugin_dir) {
+ PlugIn_LoadDir(sc_plugin_dir, true);
+ }
#ifdef SC_PLUGIN_DIR
// load globally installed plugins
- if (bfs::is_directory(SC_PLUGIN_DIR)) {
+ else if (bfs::is_directory(SC_PLUGIN_DIR)) {
PlugIn_LoadDir(SC_PLUGIN_DIR, true);
}
#endif // SC_PLUGIN_DIR
diff --git a/server/supernova/server/main.cpp b/server/supernova/server/main.cpp
index b2b5adf4e..6cb8c411c 100644
--- a/server/supernova/server/main.cpp
+++ b/server/supernova/server/main.cpp
@@ -224,8 +224,14 @@ void set_plugin_paths(server_arguments const& args, nova::sc_ugen_factory* facto
}
}
} else {
+ const char* sc_plugin_dir = getenv("SC_PLUGIN_DIR");
+ if (sc_plugin_dir) {
+ factory->load_plugin_folder(sc_plugin_dir);
+ }
#ifdef SC_PLUGIN_DIR
- factory->load_plugin_folder(SC_PLUGIN_DIR);
+ else {
+ factory->load_plugin_folder(SC_PLUGIN_DIR);
+ }
#endif
factory->load_plugin_folder(SC_Filesystem::instance().getDirectory(DirName::Resource) / SC_PLUGIN_DIR_NAME);
factory->load_plugin_folder(SC_Filesystem::instance().getDirectory(DirName::SystemExtension));

@ -0,0 +1,18 @@
{ symlinkJoin, makeWrapper, supercollider, plugins }:
symlinkJoin {
name = "supercollider-with-plugins-${supercollider.version}";
paths = [ supercollider ] ++ plugins;
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
for exe in $out/bin/*; do
wrapProgram $exe \
--set SC_PLUGIN_DIR "$out/lib/SuperCollider/plugins" \
--set SC_DATA_DIR "$out/share/SuperCollider"
done
'';
inherit (supercollider) pname version meta;
}

@ -14458,6 +14458,20 @@ with pkgs;
supercollider_scel = supercollider.override { useSCEL = true; };
supercolliderPlugins = recurseIntoAttrs {
sc3-plugins = callPackage ../development/interpreters/supercollider/plugins/sc3-plugins.nix {
fftw = fftwSinglePrec;
};
};
supercollider-with-plugins = callPackage ../development/interpreters/supercollider/wrapper.nix {
plugins = [];
};
supercollider-with-sc3-plugins = supercollider-with-plugins.override {
plugins = with supercolliderPlugins; [ sc3-plugins ];
};
taktuk = callPackage ../applications/networking/cluster/taktuk { };
tcl = tcl-8_6;

Loading…
Cancel
Save