Open mitchmindtree opened 2 years ago
The recent update to the SuperCollider nixpkgs added a wrapper that sets SC's data path, where it looks for plugins: https://github.com/NixOS/nixpkgs/blob/1ed8857f8d7dcf6711279e643fa6185ea4fdf9b3/pkgs/development/interpreters/supercollider/wrapper.nix#L13
(See below) ~~My solution to this issue is cloning the Quark repository and copying it into that path, as well as linking all the Quark dependencies there. https://github.com/ardek66/nix-livecode/blob/master/overlay.nix#L30 This removes the need of a wrapper, and scide will correctly find the plugins and classes. Also I have tested duplicate dependencies and I didn't have any errors.~~
Also, my flake provides quarks by creating Nix derivations for all the quarks in the repository, as well as automatic dependency solving, to remove the need of using Quarks.install
and the like.
Upon a closer look, I have realised that SC_PLUGIN_DIR
and SC_DATA_DIR
are environment variables added by this patch.
In the patched file, there is also a function that determines the location of the configuration file: https://github.com/supercollider/supercollider/blob/develop/common/SC_Filesystem_unix.cpp#L119
Replacing XDG_HOME
with something like SC_CONFIG_DIR
should be trivial to do, and would make it possible for a sclang_conf.yaml
to be written by nix and picked up automatically by supercollider, without the need of a wrapper calling sclang
separately, and without having to copy the plugins in a directory, which I have to admit is not very Nix-y.
EDIT: I have managed to patch SuperCollider and propagate the paths of each Quark and their dependencies to their own entries in sclang_conf.yaml
. IMO this results in a cleaner set of output paths, and it seems to solve the problem of duplicate dependencies, as SC appears to compile every directory only once, so in the case of a path appearing two or more times, its content will only be compiled once.
There's still some stuff I will have to clean up, mostly the buildQuark
function and fix the patch so that scide configuration doesn't break, as it can't save in the nix store.
Thanks for sharing your progress!
You might also be interested in some of the discussion in this SC forum post I started about adding support to SuperCollider for additively providing sets of Quarks via CLI or environment variable:
Currently, the
superdirt-start
command uses the-l
flag ofsclang
in order to provide a customsclang_conf.yaml
that includes theSuperDirt
quark and its dependencies.It would be great if we could do something similar for the
scide
command too which opens the supercollider IDE. Currently, the provided supercollider IDE does not know anything about SuperDirt or its dependencies by default.Temporary Workaround
In the meantime, this flake provides a
superdirt-install
command that installs the SuperDirt plugin and its dependencies into the user's supercollider config. If runningscide
provided by this flake, users should consider runningsuperdirt-install
first. Hopefully we can come up with a more declarative alternative that doesn't require the extra install step in the future.