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
];
};
I think you can mount an ISO image under your running system and make changes. I found a couple of guides that might be helpful:
How to Mount an ISO File on Linux
Edit and repack .iso bootable image
I haven't done this before, but I think you can
chroot
into the mount directory, and run package manager commands in the mounted image to install another package.Or I have an alternative suggestion that might or might not be easier. I've been hearing a lot about immutable/atomic distros, and people designing their own images. You could make your own ublue image, for example, with whatever you want on it.
A promising looking starting point is github:ublue-os/startingpoint. Ignore the "Installation" instructions, and follow the "ISO" instructions instead.
Or I saw recently an announcement of a new way to build atomic images that is supposed to be easier than ever, BlueBuild