Instead of getting plugins through nixpkgs I prefer to use my neovim-specific plugin manager. (In my case that's lazy.nvim.) Mostly this works without problems - but some setup is required when a plugin needs to compile something. The plugin that has given me the most trouble is Treesitter which wants to compile grammars. Here is how I got that working.
tl;dr: Configure Treesitter to compile grammars with gcc instead of clang.
As has been reported in https://github.com/nvim-treesitter/nvim-treesitter/issues/1449 Treesitter will try to use clang to compile Treesitter grammars, and on NixOS for some reason clang is not able to locate necessary C++ libraries. The fix that works for me is to configure Treesitter to use gcc instead. Here is the relevant part of my plugin config:
return {
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
config = function()
-- Set compiler to get grammar installation working in NixOS. See
-- https://github.com/nvim-treesitter/nvim-treesitter/issues/1449
require('nvim-treesitter.install').compilers = { 'gcc' }
require('nvim-treesitter.configs').setup {
ensure_installed = 'all', -- "all", or list of languages
ignore_install = { 't32' }, -- t32 is failing to download for me
}
end,
}
I still had a problem with the t32 grammar, but I don't need that one so I disable it.
Of course you need to make sure that gcc is available. You could put it in your user profile, but I prefer to make sure by using the extraPackages
option from Home Manager's neovim module. Here's my full config:
programs.neovim = {
enable = true;
defaultEditor = true;
withPython3 = true;
extraPackages = with pkgs; [
fd
gh # for github integration
ripgrep
# needed to compile fzf-native for telescope-fzf-native.nvim
gcc
gnumake
# language servers
nil # Nix LSP
lua-language-server
nixpkgs-fmt # I have nil configured to call this for formatting
];
};
Well ok, they both use symlinks but in different ways. I think what I was trying to say is that in NixOS it's symlinks all the way down.
IIUC on Fedora Atomic you have an ostree image, and some directories in the image are actually symlinks to the mutable filesystem on
/var
. Files that are not symlinks to/var
(and that are not inside those symlinked directories), are hard links to files in the ostree object store. (Basically like checked-out files in a git repository?)On NixOS this is what happens if examine what's in my path:
If I select a previous configuration when I boot I would get a different symlink target for
/run/current-system
. And what makes updates atomic is the last step is to switch the/run/current-system
symlink which switches over all installed packages at once.I can temporarily load up the version of
curl
from NixOS Unstable in a shell and see a different result,I could have a different version
curl
installed in my user profile than the one installed system-wide. In that case I'd see this:Basically symlinks upon symlinks everywhere you look. (And environment variables.)
So I guess at the end everything is symlinks on NixOS, and everything is hard links plus a set of
mount
paths on Fedora Atomic.