Skip to content
Projets

À propos

This flake provides a bleeding edge LazyVim home-manager module, allowing you to install and configure LazyVim declaratively on NixOS. It tracks LazyVim releases automatically, and uses the latest plugin versions at the time of a LazyVim release.

Outils de développement

Comment ces chiffres sont mesurés

What you can do

  • 🚀 Always up-to-date - Automatically tracks LazyVim releases with latest plugin versions
  • ✅ Zero-configuration setup - Just enable and go
  • 🤖 Reproducible builds - Core and Extra LazyVim plugins locked and in dev mode.

Progression mesurée des étoiles

in 24h
0
in 7 days
+1
in 15 days
+2
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

lazyvim-nix

A bleeding edge Nix flake for LazyVim that automatically tracks LazyVim releases and provides zero-configuration setup for NixOS and home-manager users.

🚀 Always up-to-date: Automatically tracks LazyVim releases and uses the latest plugin versions at the time of each LazyVim release.

Documentation

Quick Start

Add to your flake inputs:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    home-manager.url = "github:nix-community/home-manager";
    lazyvim.url = "github:pfassina/lazyvim-nix";
  };

  outputs = { nixpkgs, home-manager, lazyvim, ... }: {
    # Your system configuration
  };
}

Enable in your home-manager configuration:

{
  imports = [ lazyvim.homeManagerModules.default ];
  programs.lazyvim.enable = true;
}

That's it! Open nvim and enjoy LazyVim.

Version Pinning

Pin to a specific LazyVim release:

lazyvim.url = "github:pfassina/lazyvim-nix/v15.13.0";  # Pin to v15.13.0

Basic Configuration

Language Support

programs.lazyvim = {
  enable = true;

  extras = {
    lang.nix.enable = true;
    lang.python = {
      enable = true;
      installDependencies = true;        # Install ruff
      installRuntimeDependencies = true; # Install python3
    };
    lang.go = {
      enable = true;
      installDependencies = true;        # Install gopls, gofumpt, etc.
      installRuntimeDependencies = true; # Install go compiler
    };
  };

  # Additional packages (optional)
  extraPackages = with pkgs; [
    nixd       # Nix LSP
    alejandra  # Nix formatter
  ];

  # Only needed for languages not covered by LazyVim extras
  treesitterParsers = with pkgs.vimPlugins.nvim-treesitter-parsers; [
    wgsl      # WebGPU Shading Language
    templ     # Go templ files
  ];
};

Note: Treesitter grammars are installed automatically based on enabled language extras.

Dependency Control

Control which packages get installed automatically:

programs.lazyvim = {
  enable = true;

  # Core LazyVim dependencies (git, ripgrep, fd, etc.)
  installCoreDependencies = true;  # default: true

  extras = {
    lang.typescript = {
      enable = true;
      installDependencies = false;        # Skip typescript tools
      installRuntimeDependencies = true;  # But install nodejs
    };
  };
};

Note: Dependencies are opt-in per language. Set to false to manage packages manually via extraPackages.

⚠️ Experimental: Automatic dependency installation is experimental and might not cover all required packages. Use extraPackages for missing dependencies.

Custom Configuration

Option 1: Inline Configuration

programs.lazyvim = {
  enable = true;

  config = {
    options = ''
      vim.opt.relativenumber = false
      vim.opt.wrap = true
    '';

    keymaps = ''
      vim.keymap.set("n", "<leader>w", "<cmd>w<cr>", { desc = "Save" })
    '';
  };

  plugins = {
    colorscheme = ''
      return {
        "catppuccin/nvim",
        opts = { flavour = "mocha" },
      }
    '';
  };
};

Nix-managed plugin overrides should use the full owner/repo identifier, as above. They merge with LazyVim's specs by repository URL, including plugins with a custom name such as catppuccin. Dev paths use owner--repo links rather than the overridable plugin name, so repositories sharing a basename keep separate Nix packages. Multi-module packages retain their module links.

Plugin specs can also be written as Nix attrsets instead of Lua strings, using the lazyConfig helper from the flake's lib output:

programs.lazyvim.plugins = {
  colorscheme = inputs.lazyvim-nix.lib.lazyConfig {
    plugin = "catppuccin/nvim";
    opts = { flavour = "mocha"; };
  };

  # A list generates multiple specs in one file; embed Lua code
  # (e.g. functions) with lib.generators.mkLuaInline from nixpkgs
  editor = inputs.lazyvim-nix.lib.lazyConfig [
    { plugin = "neovim/nvim-lspconfig"; opts.servers.nixd = { }; }
    { plugin = "folke/noice.nvim";
      opts.routes = lib.generators.mkLuaInline "function() return my_routes end"; }
  ];
};

This works anywhere a Lua string is expected, including extras config overrides.

Option 2: File-based Configuration

For larger configurations, you can organize your LazyVim config files in a directory:

programs.lazyvim = {
  enable = true;
  configFiles = ./my-lazyvim-config;
};

Directory structure:

my-lazyvim-config/
├── config/
│   ├── keymaps.lua
│   ├── options.lua
│   └── autocmds.lua
├── plugins/
│   ├── colorscheme.lua
│   ├── lsp-config.lua
│   └── editor.lua
├── after/
│   └── queries/
│       └── elixir/
│           └── injections.scm
├── ftplugin/
│   └── nix.lua
└── snippets/
    └── global.json

Besides config/ and plugins/ (also accepted under a lua/ prefix), the following runtime directories are copied to the Neovim config root as-is: after/, colors/, ftplugin/, indent/, lsp/, queries/, snippets/, spell/, and syntax/. This lets you ship treesitter query extensions, filetype plugins, snippets, and similar runtime files alongside your Lua config.

pack/ and parser/ are intentionally not copied: plugins are managed through the Nix plugin system, and treesitter parsers through the treesitterParsers option.

Note: You can mix configFiles with inline config and plugins options, but you cannot configure the same file in both places. For example, if configFiles contains config/keymaps.lua, you cannot also set config.keymaps.

Key Features

  • 🚀 Always up-to-date - Automatically tracks LazyVim releases with latest plugin versions
  • ✅ Zero-configuration setup - Just enable and go
  • 🤖 Reproducible builds - Core and Extra LazyVim plugins locked and in dev mode.

Documentation

📖 Getting Started - Complete setup guide

⚙️ Configuration Reference - Module options and configuration

🎯 LazyVim Extras - Language and feature support

🔧 Plugin Sourcing Strategy - How plugins are resolved and managed

🚨 Troubleshooting - Common issues and solutions

Updating

nix flake update          # Update to latest LazyVim
home-manager switch       # Apply changes

Acknowledgments

License

MIT

Explorer des projets similaires

Chargement…