Skip to content

Instantly share code, notes, and snippets.

@asheshambasta
Created July 18, 2020 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asheshambasta/0c30b18cfc0b7ce617a209357268e89b to your computer and use it in GitHub Desktop.
Save asheshambasta/0c30b18cfc0b7ce617a209357268e89b to your computer and use it in GitHub Desktop.
self: super:
let
supercollider = super.libsForQt5.callPackage ../supercollider/pkg.nix { sc3plugins = null; };
sc3plugins =
super.callPackage ./pkg.nix { inherit supercollider; };
supercolliderMeta = rec {
pname = "supercollider";
version = "3.11.0";
src = super.fetchurl {
url =
"https://github.com/supercollider/supercollider/releases/download/Version-${version}/SuperCollider-${version}-Source.tar.bz2";
sha256 = "0l5j7sqrjlm85ql91ybcrvdykfkkwfqd7w3m4llbymw720r2ln9p";
};
};
in { inherit sc3plugins supercolliderMeta; }
# a simple package def to build sc3plugins.nix
# ./overlays/sc3plugins/pkg.nix
{ stdenv
, cmake
, supercollider
, fftw
, libsndfile
, fetchgit
}:
let name = "sc3plugins";
in stdenv.mkDerivation rec {
inherit name;
# https://github.com/supercollider/sc3-plugins/commit/7d08fab319198f27a5368307d0e9833c41b8053b
# date = "2020-06-05T09=30=19-07:00";
src = fetchgit {
url = "git@github.com:supercollider/sc3-plugins.git";
rev = "7d08fab319198f27a5368307d0e9833c41b8053b";
sha256 = "0qxn1dx9ccb5bkxx0mj2nxh5iqvk3xcx23rclqbc3kxv6gn41rwl";
fetchSubmodules = true;
};
buildInputs = [ cmake supercollider fftw libsndfile ];
enableParallelBuilding = true;
cmakeFlags = [
"-DSUPERNOVA=ON"
"-DSC_PATH=${supercollider}/include/SuperCollider"
"-DFFTW3F_LIBRARY=${fftw}/lib/"
];
buildPhase = ''
cmake .
cmake --build . --config Release -j 32
cmake --build . --config Release --target install -j 32
'';
postInstall = ''
echo "I am here:"
pwd
ls -a
echo "outPath:"
echo "$outPath"
echo "things at outpath:"
ls -a $outPath/
echo "out:"
echo "$out"
echo "things at out:"
ls -a $out/
'';
}
# the overlay for supercollider assumes that sc3plugins is present in super.
self: super:
let
mkDerivation = super.stdenv.mkDerivation;
# the package definition of supercollider now also expects the sc3plugins argument.
supercollider = super.libsForQt5.callPackage ./pkg.nix { useSCEL = true;
};
in { inherit supercollider; }
# copy pasted derivation https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/interpreters/supercollider/default.nix
{ stdenv, mkDerivation, fetchurl, cmake, pkgconfig, alsaLib, libjack2
, libsndfile, fftw, curl, gcc, libXt, qtbase, qttools, qtwebengine, readline
, qtwebsockets, useSCEL ? false, emacs
# we've only added the plugins here.
, sc3plugins ? null, supercolliderMeta }:
let optional = stdenv.lib.optional;
in mkDerivation {
inherit (supercolliderMeta) pname version src;
hardeningDisable = [ "stackprotector" ];
cmakeFlags = [ "-DSC_WII=OFF" "-DSC_EL=${if useSCEL then "ON" else "OFF"}" ];
nativeBuildInputs = [ cmake pkgconfig qttools ];
enableParallelBuilding = true;
buildInputs = [
gcc
libjack2
libsndfile
fftw
curl
libXt
qtbase
qtwebengine
qtwebsockets
readline
] ++ optional (!stdenv.isDarwin) alsaLib ++ optional useSCEL emacs;
meta = with stdenv.lib; {
description = "Programming language for real time audio synthesis";
homepage = "https://supercollider.github.io";
maintainers = with maintainers; [ mrmebelman ];
license = licenses.gpl3;
platforms = [ "x686-linux" "x86_64-linux" ];
};
postFixup = if (builtins.isNull sc3plugins) then
""
else ''
echo "I am here:"
pwd
ls -a
echo "outPath:"
echo "$outPath"
echo "things at outpath:"
ls -a $outPath/
echo "out:"
echo "$out"
echo "things at out:"
ls -a $out/
echo "Copying sc3plugins to the extensions dir: $out/share/SuperCollider/Extensions"
cp -r ${sc3plugins}/share/SuperCollider/Extensions/SC3plugins $out/share/SuperCollider/Extensions
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment