nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchpatch,
5 fetchurl,
6 cmake,
7 runtimeShell,
8 pkg-config,
9 alsa-lib,
10 libjack2,
11 libsndfile,
12 fftw,
13 curl,
14 gcc,
15 libsForQt5,
16 libXt,
17 qtbase,
18 qttools,
19 qtwebengine,
20 readline,
21 qtwebsockets,
22 qtwayland,
23 useSCEL ? false,
24 emacs,
25 gitUpdater,
26 supercollider-with-plugins,
27 supercolliderPlugins,
28 writeText,
29 runCommand,
30 withWebengine ? false, # vulnerable, so disabled by default
31}:
32
33stdenv.mkDerivation rec {
34 pname = "supercollider";
35 version = "3.13.1";
36
37 src = fetchurl {
38 url = "https://github.com/supercollider/supercollider/releases/download/Version-${version}/SuperCollider-${version}-Source.tar.bz2";
39 sha256 = "sha256-aXnAFdqs/bVZMovoDV1P4mv2PtdFD2QuXHjnsnEyMSs=";
40 };
41
42 patches = [
43 # add support for SC_DATA_DIR and SC_PLUGIN_DIR env vars to override compile-time values
44 ./supercollider-3.12.0-env-dirs.patch
45
46 # Fixes the build with CMake 4
47 (fetchpatch {
48 url = "https://github.com/supercollider/supercollider/commit/7d1f3fbe54e122889489a2f60bbc6cd6bb3bce28.patch";
49 hash = "sha256-gyE0B2qTbj0ppbLlYTMa2ooY3FHzzIrdrpWYr81Hy1Y=";
50 })
51
52 # Fixes the build with GCC 15
53 (fetchpatch {
54 url = "https://github.com/supercollider/supercollider/commit/edfac5e24959b12286938a9402326e521c2d2b63.patch";
55 hash = "sha256-8DNCO5VEX6V0Q29A/v5tFC7u835bwNHvcNlZzmS0ADg=";
56 })
57 ];
58
59 postPatch = ''
60 substituteInPlace common/sc_popen.cpp --replace '/bin/sh' '${runtimeShell}'
61 '';
62
63 strictDeps = true;
64
65 nativeBuildInputs = [
66 cmake
67 pkg-config
68 qttools
69 libsForQt5.wrapQtAppsHook
70 ]
71 ++ lib.optionals useSCEL [ emacs ];
72
73 buildInputs = [
74 gcc
75 libjack2
76 libsndfile
77 fftw
78 curl
79 libXt
80 qtbase
81 qtwebsockets
82 qtwayland
83 readline
84 ]
85 ++ lib.optional withWebengine qtwebengine
86 ++ lib.optional (!stdenv.hostPlatform.isDarwin) alsa-lib;
87
88 hardeningDisable = [ "stackprotector" ];
89
90 cmakeFlags = [
91 "-DSC_WII=OFF"
92 "-DSC_EL=${if useSCEL then "ON" else "OFF"}"
93 (lib.cmakeBool "SC_USE_QTWEBENGINE" withWebengine)
94 ];
95
96 passthru = {
97 updateScript = gitUpdater {
98 url = "https://github.com/supercollider/supercollider.git";
99 rev-prefix = "Version-";
100 ignoredVersions = "rc|beta";
101 };
102
103 tests = {
104 # test to make sure sclang runs and included plugins are successfully found
105 sclang-sc3-plugins =
106 let
107 supercollider-with-test-plugins = supercollider-with-plugins.override {
108 plugins = with supercolliderPlugins; [ sc3-plugins ];
109 };
110 testsc = writeText "test.sc" ''
111 var err = 0;
112 try {
113 MdaPiano.name.postln;
114 } {
115 err = 1;
116 };
117 err.exit;
118 '';
119 in
120 runCommand "sclang-sc3-plugins-test" { } ''
121 timeout 60s env XDG_CONFIG_HOME="$(mktemp -d)" QT_QPA_PLATFORM=minimal ${supercollider-with-test-plugins}/bin/sclang ${testsc} >$out
122 '';
123 };
124 };
125
126 meta = {
127 description = "Programming language for real time audio synthesis";
128 homepage = "https://supercollider.github.io";
129 changelog = "https://github.com/supercollider/supercollider/blob/Version-${version}/CHANGELOG.md";
130 maintainers = [ ];
131 license = lib.licenses.gpl3Plus;
132 platforms = lib.platforms.linux;
133 };
134}