diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2022-04-21 18:02:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-21 18:02:06 +0000 |
commit | cbc56d5cc346783465887e8b9b8a24e3b5d714ed (patch) | |
tree | 6cbe1cebb1037ec302c60e33c11c91e38418d557 /pkgs/development/interpreters | |
parent | fa6aa9eeb7c2524dc2830b119925c552cd250cbe (diff) | |
parent | 688761d659c8e474af0aca07c395dc5adb2ae26d (diff) |
Merge staging-next into staging
Diffstat (limited to 'pkgs/development/interpreters')
5 files changed, 163 insertions, 20 deletions
diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 97db4a9fffa85..4463dc8e9ba0d 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -49,7 +49,7 @@ , enableLTO ? stdenv.is64bit && stdenv.isLinux , reproducibleBuild ? false , pythonAttr ? "python${sourceVersion.major}${sourceVersion.minor}" -}: +} @ inputs: # Note: this package is used for bootstrapping fetchurl, and thus # cannot use fetchpatch! All mutable patches (generated by GitHub or @@ -83,7 +83,11 @@ let tzdataSupport = tzdata != null && passthru.pythonAtLeast "3.9"; - passthru = passthruFun rec { + passthru = let + # When we override the interpreter we also need to override the spliced versions of the interpreter + inputs' = lib.filterAttrs (_: v: ! lib.isDerivation v) inputs; + override = attr: let python = attr.override (inputs' // { self = python; }); in python; + in passthruFun rec { inherit self sourceVersion packageOverrides; implementation = "cpython"; libPrefix = "python${pythonVersion}"; @@ -91,11 +95,11 @@ let pythonVersion = with sourceVersion; "${major}.${minor}"; sitePackages = "lib/${libPrefix}/site-packages"; inherit hasDistutilsCxxPatch; - pythonOnBuildForBuild = pkgsBuildBuild.${pythonAttr}; - pythonOnBuildForHost = pkgsBuildHost.${pythonAttr}; - pythonOnBuildForTarget = pkgsBuildTarget.${pythonAttr}; - pythonOnHostForHost = pkgsHostHost.${pythonAttr}; - pythonOnTargetForTarget = pkgsTargetTarget.${pythonAttr} or {}; + pythonOnBuildForBuild = override pkgsBuildBuild.${pythonAttr}; + pythonOnBuildForHost = override pkgsBuildHost.${pythonAttr}; + pythonOnBuildForTarget = override pkgsBuildTarget.${pythonAttr}; + pythonOnHostForHost = override pkgsHostHost.${pythonAttr}; + pythonOnTargetForTarget = if lib.hasAttr pythonAttr pkgsTargetTarget then (override pkgsTargetTarget.${pythonAttr}) else {}; }; version = with sourceVersion; "${major}.${minor}.${patch}${suffix}"; diff --git a/pkgs/development/interpreters/supercollider/default.nix b/pkgs/development/interpreters/supercollider/default.nix index 2a0ef3b0957c6..0446e5d540c1f 100644 --- a/pkgs/development/interpreters/supercollider/default.nix +++ b/pkgs/development/interpreters/supercollider/default.nix @@ -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; }; diff --git a/pkgs/development/interpreters/supercollider/plugins/sc3-plugins.nix b/pkgs/development/interpreters/supercollider/plugins/sc3-plugins.nix new file mode 100644 index 0000000000000..a596d6d770aef --- /dev/null +++ b/pkgs/development/interpreters/supercollider/plugins/sc3-plugins.nix @@ -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; + }; +} diff --git a/pkgs/development/interpreters/supercollider/supercollider-3.12.0-env-dirs.patch b/pkgs/development/interpreters/supercollider/supercollider-3.12.0-env-dirs.patch new file mode 100644 index 0000000000000..dd92028b52256 --- /dev/null +++ b/pkgs/development/interpreters/supercollider/supercollider-3.12.0-env-dirs.patch @@ -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)); diff --git a/pkgs/development/interpreters/supercollider/wrapper.nix b/pkgs/development/interpreters/supercollider/wrapper.nix new file mode 100644 index 0000000000000..e9e97f2b98de9 --- /dev/null +++ b/pkgs/development/interpreters/supercollider/wrapper.nix @@ -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; +} |