So we have a package called supercollider
; and that is helpfully available to us as a package.
Now; I’ve written something to build sc3plugins; and this is my nix derivation; which seems to build without issues.
{ pkgs ? (import <nixpkgs> { }) }:
let name = "sc3-plugins";
in pkgs.stdenv.mkDerivation rec {
inherit name;
# https://github.com/supercollider/sc3-plugins/commit/7d08fab319198f27a5368307d0e9833c41b8053b
# date = "2020-06-05T09=30=19-07:00";
src = pkgs.fetchgit {
url = "git@github.com:supercollider/sc3-plugins.git";
rev = "7d08fab319198f27a5368307d0e9833c41b8053b";
sha256 = "0qxn1dx9ccb5bkxx0mj2nxh5iqvk3xcx23rclqbc3kxv6gn41rwl";
fetchSubmodules = true;
};
buildInputs = with pkgs; [ cmake supercollider fftw libsndfile ];
cmakeFlags = with pkgs; [
"-DSUPERNOVA=ON"
"-DSC_PATH=${supercollider}/include/SuperCollider"
"-DFFTW3F_LIBRARY=${fftw}/lib/"
];
buildPhase = ''
cmake .
cmake --build . --config Release
cmake --build . --config Release --target install
'';
}
Now; to be able to use the plugins in super collider; these plugins need to be kept in
${pkgs.supercollider}/share/SuperCollider/Extensions
.
I’m now trying to write an overlay that can achieve that; but I feel totally lost on how to achieve it.
My line of thought so far is to have this in the installPhase
of the supercollider derivation; something on the lines of:
self: super:
let
# the plugins must be added to share/SuperCollider/Extensions
plugins = (import ./sc3plugins.nix) { pkgs = super; } ;
overrideOld = oldAttrs: oldAttrs // {
installPhase = ''
ls ${super.supercollider}
ls $plugins
'';
};
in {
supercollider = super.supercollider.overrideAttrs ( overrideOld );
}
When trying to run the above in a REPL; things fail:
nix-repl> pkgs = import <nixpkgs> { overlays = [ (import ./supercollider.nix) ]; }
nix-repl> :b pkgs.supercollider
builder for '/nix/store/xn073lkx5ky75zmy6nmqqdxswcmghnxq-supercollider-3.10.4.drv' failed to produce output path '/nix/store/qy5h87c1hlv6piq96lnqjnmcd89kq6gv-supercollider-3.10.4'
[0 built (1 failed), 4 copied (15.2 MiB), 14.8 MiB DL]
error: build of '/nix/store/xn073lkx5ky75zmy6nmqqdxswcmghnxq-supercollider-3.10.4.drv' failed
Now; given that my installPhase
looks relatively harmless; I find it confusing as to why this fails.
And regarding this; I have several questions.
- How does one test overlays?
For example; I can donix-build foobar.nix --keep-failed
to peek around for normal derivations. But that assumption doesn’t work inside a repl. - Can someone nudge me in the right direction here? How can I say; in an overlay; that whatever the build output of a given package is; also add the following things to some paths under it; or is this considered bad practice?