Skip to content

Commit 3f3a820

Browse files
Merge pull request #14 from heyarne/feature/choose-start-script
Allow passing in custom start script as param to superdirt-start
2 parents 91811af + db0fd2d commit 3f3a820

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Includes the following packages:
2626

2727
| Package | Description |
2828
| --- | --- |
29-
| `superdirt-start` | A short-hand command for starting up SuperCollider and running `SuperDirt.start;`. No need to manually install `SuperDirt` as it is provided to `sclang` via a custom `sclang_conf.yaml`. |
29+
| `superdirt-start` | A short-hand command for starting up SuperCollider and running `SuperDirt.start;`. No need to manually install `SuperDirt` as it is provided to `sclang` via a custom `sclang_conf.yaml`. If you want to use a custom start script (e.g. to load additional samples), you can pass its path as an argument to the command. |
3030
| `tidal` | A command for entering the `GHCi` interpreter initialised with [`BootTidal.hs`](https://github.com/tidalcycles/Tidal/blob/main/BootTidal.hs) and the Tidal library loaded. This is a useful repl for experimenting with Tidal. |
3131
| `superdirt-install` | A command for installing SuperDirt and its dependencies under the user's SuperCollider configuration (the traditional installation approach). This is currently the recommended way to provide SuperDirt to the SuperCollider IDE until [this issue](https://github.com/mitchmindtree/tidalcycles.nix/issues/3) is addressed. |
3232
| `vim-tidal` | This is the official [tidalcycles Vim plugin](https://github.com/tidalcycles/vim-tidal) packaged for Nix and patched to use the `tidal` command for its GHCi interpreter. |

flake.nix

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,24 @@
8686
name = "superdirt-start";
8787
runtimeInputs = [supercollider];
8888
text = ''
89-
${sclang-with-superdirt}/bin/sclang-with-superdirt ${superdirt-start-sc}
89+
start_script="''${1:-${superdirt-start-sc}}"
90+
91+
if [ "$start_script" == "-h" ] || [ "$start_script" == "--help" ]; then
92+
echo "Usage: superdirt-start [script]"
93+
echo
94+
echo "Start superdirt, optionally running a custom start script."
95+
echo
96+
echo "Options:"
97+
echo " -h --help Show this screen."
98+
exit
99+
fi
100+
101+
if [ ! -e "$start_script" ]; then
102+
echo "The script \"$start_script\" does not exist, aborting."
103+
exit 1
104+
fi
105+
106+
${sclang-with-superdirt}/bin/sclang-with-superdirt "$start_script"
90107
'';
91108
};
92109

0 commit comments

Comments
 (0)