Skip to content

Commit fbdd3fb

Browse files
Merge pull request #12 from mitchmindtree/vim-plugin-superdirt
Guarantee availability of Tidal, SuperDirt to Vim Plugin
2 parents 11c2a0a + c75c477 commit fbdd3fb

File tree

3 files changed

+40
-15
lines changed

3 files changed

+40
-15
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- uses: cachix/install-nix-action@v16
2626
with:
2727
nix_path: nixpkgs=channel:nixos-unstable
28-
- run: nix flake check
28+
- run: nix flake check --no-update-lock-file
2929

3030
# Checks the nix formatting.
3131
template-fmt-check:

flake.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# TODO: Switch back to `tidalcycles` repo once Vim8 terminal support lands.
2727
# See this PR: https://github.com/tidalcycles/vim-tidal/pull/74
2828
# url = "github:tidalcycles/vim-tidal/master";
29-
url = "github:mitchmindtree/vim-tidal/flupe-vim8-terminal-rebased";
29+
url = "github:mitchmindtree/vim-tidal/superdirt-term";
3030
flake = false;
3131
};
3232
vowel-src = {
@@ -73,11 +73,15 @@
7373
};
7474

7575
# Run `SuperDirt.start` in supercollider, ready for tidal.
76-
superdirt-start = pkgs.writeShellScriptBin "superdirt-start" ''
77-
${supercollider}/bin/sclang \
78-
-l "${superdirt}/sclang_conf.yaml" \
79-
${pkgs.writeText "superdirt-start.sc" "SuperDirt.start;"}
80-
'';
76+
superdirt-start = pkgs.writeShellApplication {
77+
name = "superdirt-start";
78+
runtimeInputs = [supercollider];
79+
text = ''
80+
${supercollider}/bin/sclang \
81+
-l "${superdirt}/sclang_conf.yaml" \
82+
${pkgs.writeText "superdirt-start.sc" "SuperDirt.start;"}
83+
'';
84+
};
8185

8286
# Installs SuperDirt under your user's supercollider quarks.
8387
superdirt-install = pkgs.writeShellScriptBin "superdirt-start" ''
@@ -94,10 +98,31 @@
9498
pname = "vim-tidal";
9599
version = "master";
96100
src = inputs.vim-tidal-src;
97-
# Patch the default GHCI with our `tidal` instance.
98-
# TODO: Update `vim-tidal` to use an env var by default or something instead.
99-
# Would be much cleaner than a patch with might conflict with future commits.
100-
patches = [./patch/vim-tidal-ghci.patch];
101+
postInstall = let
102+
# A vimscript file to set Nix defaults for ghci and `BootTidal.hs`.
103+
defaults-file = pkgs.writeText "vim-tidal-defaults.vim" ''
104+
" Prepend defaults provided by Nix packages.
105+
if !exists("g:tidal_ghci")
106+
let g:tidal_ghci = "${ghcWithTidal}/bin/ghci"
107+
endif
108+
if !exists("g:tidal_boot")
109+
let g:tidal_boot = "${inputs.tidal-src}/BootTidal.hs"
110+
endif
111+
if !exists("g:tidal_superdirt_start")
112+
let g:tidal_superdirt_start = "${superdirt-start}/bin/superdirt-start"
113+
endif
114+
'';
115+
in ''
116+
# Prepend a line to `plugin/tidal.vim` to source the defaults.
117+
mv $out/plugin/tidal.vim $out/plugin/tidal.vim.old
118+
cat ${defaults-file} $out/plugin/tidal.vim.old > $out/plugin/tidal.vim
119+
rm $out/plugin/tidal.vim.old
120+
121+
# Remove unnecessary files.
122+
rm -r $out/bin
123+
rm $out/Makefile
124+
rm $out/Tidal.ghci
125+
'';
101126
meta = {
102127
homepage = "https://github.com/tidalcycles/vim-tidal.vim";
103128
license = pkgs.lib.licenses.mit;

0 commit comments

Comments
 (0)