-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Neve modular #96
Comments
Hello tuxi, could you provide an example? |
Hi! In Nix you can create a module, and within it define options (using For example: https://nix.dev/tutorials/module-system/a-basic-module/index.html For example, the NixOS module |
That's an amazing idea, I'll take a deeper look into it. Thanks! 😄 |
FYI, this is how I approached this: I used the Neve flake with a custom config that I provide using # flake.nix
inputs.neve.url = "github:redyf/Neve";
...
myConfig = {
extraPackages = with pkgs; [
alejandra # nix formatter
...
];
extraPlugins = with pkgs.vimPlugins; [
eyeliner-nvim
...
];
plugins = {
alpha.enable = pkgs.lib.mkForce false; # welcome screen
copilot-lua.enable = pkgs.lib.mkForce false;
indent-blankline.enable = pkgs.lib.mkForce false; # indentation guides
lint = {
lintersByFt = {
sh = ["shellcheck"];
...
};
extraConfigLua = ''
require("cmp").setup {
...
};
keymaps = ...
};
...
myNeve = neve.packages."${system}".default.nixvimExtend { config = myConfig;}; |
I had no idea you could do that haha, really cool 🔥 |
Hi! I couldn't find another way to contact you through your profile, so I'm using this issue for discussion. I'm currently working on my own NixVim configuration, taking inspiration from Neve and other projects. One challenge I encountered is the need for certain packages to be installed on the host system, such as prettierd, golines, gopls, ruff, etc., to get them working in Nix/Neovim. I'm trying to solve this by creating a fully independent configuration that automatically enables LSPs, completions, and snippets based on the languages installed on the system. For example, if a user has Go installed, then the Go LSP and related features will be enabled; the same would apply for Node.js, Python, and other languages. Have you considered this approach? The methods used by @tuxiqae and @rolfschr seem like a perfect example of how to achieve this. Currently, I have a basic initial configuration set up for this purpose. # packages.nix
{pkgs}: let
commandExists = cmd: builtins.pathExists (pkgs.lib.getExe cmd);
in {
inherit commandExists;
pythonAvailable = commandExists pkgs.python3;
nodeAvailable = commandExists pkgs.nodejs;
goAvailable = commandExists pkgs.go;
rustAvailable = commandExists pkgs.rustc;
} # helpers.nix
{
pkgs,
helpers,
}: let
pythonPackages = with pkgs;
if helpers.pythonAvailable
then [
black
ruff
]
else [];
nodePackages = with pkgs.nodePackages;
if helpers.nodeAvailable
then [
eslint_d
prettierd
]
else [];
goPackages = with pkgs;
if helpers.goAvailable
then [
gofumpt
golines
golangci-lint
]
else [];
generalPackages = with pkgs; [
alejandra
ripgrep
fd
jq
];
in {
inherit pythonPackages goPackages nodePackages generalPackages;
allPackages = pythonPackages ++ nodePackages ++ goPackages ++ generalPackages;
} If these packages are not installed, the formatters will still attempt to run, but they won't function correctly since they are not present in the host system's PATH. A straightforward solution would be to install these packages, but the approach I'm taking is to configure it so that if a package isn't available, it simply won't be installed or used. In conform, we might have: # conform.nix
plugins.conform-nvim = {
enable = true;
formatters = {
black.enable = pythonAvailable;
prettier.enable = nodeAvailable;
gofmt.enable = goAvailable;
rustfmt.enable = rustAvailable;
};
formattersByFt = {
python = lib.mkIf pythonAvailable ["black"];
javascript = lib.mkIf nodeAvailable ["prettier"];
typescript = lib.mkIf nodeAvailable ["prettier"];
go = lib.mkIf goAvailable ["gofmt"];
rust = lib.mkIf rustAvailable ["rustfmt"];
};
}; In By having these shipped with the configuration, we might be able to make it completely independent of the host. |
I've never considered this approach, but it does look interesting. Usually what I do is just use a nix flake + direnv. It's great to see there are so many ways available to setup an environment with nix. |
I think an example that uses I'll try to write one myself on my free-time and comment it here |
Indeed, that sounds good. I'll be kinda busy with work and some exams in the next few days so a PR would be very much appreciated for that one. Thanks for the suggestion 🙂 |
Allow users to customize their Neve experience using Nix options
The text was updated successfully, but these errors were encountered: