The basic features of the plugin work as intended. As an extra feature, this plug-in also provides an iced binary. Reference from vim-iced
2.1.2. iced command
iced is a utility command to make you easy to use vim-iced, and it comes with vim-iced. Setup is easy, just add the bin directory under the installed vim-iced directory to $PATH environmental variable. With above vim-plug setting, ~/.vim/plugged/vim-iced/bin is the directory to add to $PATH.
# For bash or zsh
$ export PATH=$PATH:~/.vim/plugged/vim-iced/bin
My derivation does not expose that automatically. The installed derivation does provide the binary in a working condition:
>> find /nix/store -name 'vim-iced'
/nix/store/<hash>-vim-pack-dir/pack/myVimPackage/start/vim-iced
>>
>> ls -l /nix/store/<hash>-vim-pack-dir/pack/myVimPackage/start/vim-iced/bin/
total 20
-r-xr-xr-x 1 jayesh admin 14511 Jan 1 1970 iced
-r--r--r-- 1 jayesh admin 64 Jan 1 1970 iced.cmd
>>
>> /nix/store/<hash>-vim-pack-dir/pack/myVimPackage/start/vim-iced/bin/iced version
3.6.2
Can anyone guide me how I can expose this iced binary to the shell?
I managed to solve this by building another derivation on top of vim-iced plugin derivation:
{ vim-iced, stdenv }:
# adapted from: https://github.com/NixOS/nixpkgs/blob/8b2e7324dc19b892bf3785d11fea338cfb4d1426/pkgs/applications/editors/vim/vimacs.nix
# Like vim-iced, vimacs plugin also provides a binary (bin/vim) which needs to be exposed to $PATH explicitly.
# In Nix, ~/.nix-profile/bin (which itself is a symlink that points to the current Nix profile) is exposed to $PATH, and all the binaries in the `bin` dir of the installed derivations of the current profile are symlinked inside ~/.nix-profile/bin.
# The problem is a derivation's `bin` is symlinked to ~/.nix-profile only if the derivation is installed directly (and not indirectly like vim-iced, which is handled by neovim).
# The solution for vimacs is to have two derivations:
# vimPlugins.vimacs, which acts as the actual vim plugin, and
# vimacs, which links to the content of `vimPlugins.vimacs` so as not to duplicate them, and then exposes `vimacs` binary within to $PATH.
# This derivation follows the same approach: expose the `iced` binary from the `vim-iced` plugin derivation by symlinking to the full contentof `vim-iced`. Symlinking to just `bin/iced` raises errors while invoking `iced repl`. So better safe than sorry.
stdenv.mkDerivation rec {
pname = "iced-repl";
version = vim-iced.version;
buildInputs = [ vim-iced ];
buildCommand = ''
ln -s "${vim-iced}"/share/vim-plugins/vim-iced $out
'';
}
Scratch the last comment completely (I cannot edit it anymore).
A much simpler solution is to install vim-icedBOTH as a:
vimPlugin, in order to use the plugin features from vim
standalone package, so that Nix symlinks the bin/iced binary to ~/.nix-profile/bin without extra efforts on our part. This redundant installation does not affect the functions of the vimPlugin installation.
Isn’t the “bin” directory too deep in the path for nix to add it to the PATH? I think nix only adds bin directories immediately after the output path (like /nix/store/6n1shhsf3ryn7sm81ih11gfrrsq0hx41-vimplugin-vim-iced/bin, as opposed to /nix/store/6n1shhsf3ryn7sm81ih11gfrrsq0hx41-vimplugin-vim-iced/share/vim-plugins/vim-iced/bin).
I tried adding it as a system package but iced command still couldn’t be found.