mitchmindtree / tidalcycles.nix

A Nix flake for Tidal Cycles.
GNU General Public License v3.0
60 stars 11 forks source link

Custom `BootTidal.hs` is ignored #20

Closed rrrnld closed 1 month ago

rrrnld commented 11 months ago

I'd like to customize my BootTidal.hs when running vim-tidal through this flake. I set up vim-tidal globally as a neovim plugin through home-manager.

When opening a directory with a BootTidal.hs, the path seems to be set OK (tested via :echo g:tidal_boot), but the prompt that appears when evaluating the first expression always starts like this:

GHCi, version 9.4.6: https://www.haskell.org/ghc/  :? for help
[TidalCycles version 1.9.4]
Installed in /nix/store/sr8dina38j40bm5fpfd0inljdbafza4y-tidal-1.9.4-data/share/ghc-9.4.6/x86_64-linux-ghc-9.4.6/tidal-1.9.4
Listening for external controls on 127.0.0.1:6010
Connected to SuperDirt.
Loaded GHCi configuration from /nix/store/zlxa2pk4kizcwp81a61c7vk5zrvmbx1c-source/BootTidal.hs
tidal> d1 $s "bd"

This happens regardless of whether I use the BootTidal.hs discovery via directory traversal, open neovim via nvim --cmd ':let g:tidal_boot="/path/to/custom/BootTidal.hs"' test.tidal, via nvim +':let g:tidal_boot="/path/to/custom/BootTidal.hs"' test.tidal or export TIDAL_BOOTH_PATH=…. Am I missing something?

I'm not sure if this is a problem of this flake, or if it's a problem of the vim-tidal plugin. I'll open an issue in both repositories.

Thanks for any help!

PS: I first thought that this has something to do with the patch in this repo. The patch is unused at the moment though, correct?

rrrnld commented 10 months ago

As @mitchmindtree suggested in the other issue, I tried reproducing this with normal vim. I did so by building vim and nvim using the vim-tidal plugin provided by the overlay in this repo (which is set up using nix flake new --template github:mitchmindtree/tidalcycles.nix#templates.default vim-tidal-repro and then edited a bit) https://github.com/heyarne/vim-tidal-repro/blob/258388336e1c0c928d1daf2566ad01c647dd0291/flake.nix#L16-L30

I can use both of these and g:tidal_boot looks right (BootTidal.hs when in the same directory, otherwise it's an absolute path). g:tidal_ghci is set to /nix/store/8vjfxz19g68x541w6dffgq64d1rx3b72-ghc-9.4.7-with-packages/bin/ghci for both nvim / vim.

My system config uses the overlay and configures neovim via home-manager:

    programs.neovim = {
      enable = true;
      viAlias = true;
      vimAlias = true;
      extraConfig = ''
        let mapleader = " "
        let maplocalleader = ","

        " make searching nicer
        set ignorecase  " do case insensitive search 
        set incsearch   " show incremental search results as you type

        " Sensible indentation
        set tabstop=2
        set expandtab
        set shiftwidth=2
        set autoindent
        set smartindent

        " Use system clipboard
        set clipboard+=unnamedplus
      '';
      plugins = with pkgs.vimPlugins; [
        # … some other plugins …
        {
          plugin = vim-tidal;
        }
      ];
    };

The global config somehow breaks the BootTidal.hs lookup.

rrrnld commented 10 months ago

Is s:FindTidalBoot (here) maybe executed too early? Running let tidal_boot_file = findfile("BootTidal.hs", ".".';') manually after opening my global neovim finds the file just fine.

rrrnld commented 1 month ago

Updated to the latest version of this flake and this issue has been resolved