{"id":22319582,"url":"https://github.com/pierrot-lc/nvim-nix","last_synced_at":"2025-10-14T11:32:41.108Z","repository":{"id":219447844,"uuid":"748989643","full_name":"pierrot-lc/nvim-nix","owner":"pierrot-lc","description":"Pierrot's Neovim flake","archived":false,"fork":false,"pushed_at":"2025-01-22T21:14:27.000Z","size":316,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-23T00:09:11.516Z","etag":null,"topics":["dotfiles","neovim","neovim-dotfiles","nix","nix-flake"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pierrot-lc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-27T08:53:57.000Z","updated_at":"2025-01-22T21:14:31.000Z","dependencies_parsed_at":"2024-04-15T17:14:03.965Z","dependency_job_id":"05abc3b0-2187-47c0-bac4-6ff4f828398e","html_url":"https://github.com/pierrot-lc/nvim-nix","commit_stats":null,"previous_names":["pierrot-lc/nvim-nix"],"tags_count":0,"template":false,"template_full_name":"nix-community/kickstart-nix.nvim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierrot-lc%2Fnvim-nix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierrot-lc%2Fnvim-nix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierrot-lc%2Fnvim-nix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierrot-lc%2Fnvim-nix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pierrot-lc","download_url":"https://codeload.github.com/pierrot-lc/nvim-nix/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236470435,"owners_count":19153863,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotfiles","neovim","neovim-dotfiles","nix","nix-flake"],"created_at":"2024-12-04T00:10:00.405Z","updated_at":"2025-10-14T11:32:41.103Z","avatar_url":"https://github.com/pierrot-lc.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# My Neovim Flake\n\nThis is my neovim configuration implemented as a flake. Thanks to the power of\nnix and flakes, my whole neovim configuration can be built with a single\ncommand.\n\nBased on the template from\n[kickstart-nix.nvim](https://github.com/nix-community/kickstart-nix.nvim). If\nyou come from this template, please know that I made some slights modifications\na little.\n\nSome of the features:\n\n- LSPs, linters, formatters for Python.\n- Use [Neorg](https://github.com/nvim-neorg/neorg) for note taking.\n- Optionally use Neovim nightly.\n\nNote: Many LSPs, formatters and others are not packaged in this flake. You have\nto provide them yourself. See this [debate](\nhttps://www.reddit.com/r/NixOS/comments/18oai2a/should_lsp_servers_be_in_the_project_flake/)\nfor more.\n\n\n## Themes\n\nThere are multiple themes available and you can activate a specific theme by\npassing the `config.theme` value to the nix package at build time. You can\nchoose between the following themes:\n\n- [`catppuccin`](https://github.com/catppuccin/nvim)\n- [`gruvbox`](https://github.com/ellisonleao/gruvbox.nvim/)\n- [`rose-pine`](https://github.com/rose-pine/neovim)\n\nSee `./nix/module.nix` for the available option values.\n\n## Installation\n\n### Test Drive\n\nIf you have Nix installed (with [flakes](https://nixos.wiki/wiki/Flakes)\nenabled), you can test drive this by running:\n\n```console\nnix run \"github:pierrot-lc/nvim-nix\"\n```\n\n### NixOS and Home Manager (with flakes)\n\nAdd this flake to your NixOS flake inputs.\n\n```nix\n{\n  inputs = {\n    nixpkgs.url = \"nixpkgs/nixos-unstable\";\n\n    nvim-nix = {\n      url = \"github:pierrot-lc/nvim-nix\";\n      inputs.nixpkgs.follows = \"nixpkgs\";\n    };\n    # ...\n  };\n\n  # ...\n}\n```\n\n#### Using the Overlay\n\nOverlays are a way to provide additional packages to the list of available\n`pkgs`. This flake output such overlay to add our `nvim-nix` derivation to\n`pkgs`. Here is a minimal example with home-manager:\n\n```nix\n# flake.nix\n{\n  inputs = {\n    nixpkgs.url = \"nixpkgs/nixos-unstable\";\n    home-manager = {\n      url = \"github:nix-community/home-manager\";\n      inputs.nixpkgs.follows = \"nixpkgs\";\n    };\n\n    nvim-nix = {\n      url = \"github:pierrot-lc/nvim-nix\";\n      inputs.nixpkgs.follows = \"nixpkgs\";\n    };\n  };\n\n  outputs = inputs @ {\n    self,\n    nixpkgs,\n    home-manager,\n    ...\n  }: let\n    system = \"x86_64-linux\";\n    lib = nixpkgs.lib;\n\n    pkgs = import nixpkgs {\n      inherit system;\n\n      overlays = [\n        # We provide our `nvim-nix` package by giving the overlay here.\n        inputs.nvim-nix.overlays.${system}.default\n      ];\n    };\n  in {\n    homeConfigurations = {\n      username = home-manager.lib.homeManagerConfiguration {\n        inherit pkgs;\n\n        modules = [\n          ./home.nix\n        ];\n      };\n    };\n  };\n}\n```\n\n```nix\n# home.nix\n{pkgs, ...}: {\n  home.packages = with pkgs; [\n    nvim-nix # This package will be found thanks to the added overlays.\n  ];\n}\n```\n\n#### Using the Module\n\nThis flake also provide a module. It provides an interface to specify options\nbefore building the derivation. You can have a look into `./nix/module.nix` to\nsee the available options for yourself, along with their default values.\n\nTo make this work, you do not have to add this flake overlay but you have to\nprovide the module. Here is a minimal example:\n\n```nix\n# flake.nix\n{\n  inputs = {\n    nixpkgs.url = \"nixpkgs/nixos-unstable\";\n    home-manager = {\n      url = \"github:nix-community/home-manager\";\n      inputs.nixpkgs.follows = \"nixpkgs\";\n    };\n\n    nvim-nix = {\n      url = \"github:pierrot-lc/nvim-nix\";\n      inputs.nixpkgs.follows = \"nixpkgs\";\n    };\n  };\n\n  outputs = inputs @ {\n    self,\n    nixpkgs,\n    home-manager,\n    ...\n  }: let\n    system = \"x86_64-linux\";\n    lib = nixpkgs.lib;\n\n    pkgs = import nixpkgs {\n      inherit system;\n    };\n  in {\n    homeConfigurations = {\n      username = home-manager.lib.homeManagerConfiguration {\n        inherit pkgs;\n\n        modules = [\n          ./home.nix\n          # Add the module here.\n          inputs.nvim-nix.hmModules.${system}.default\n        ];\n      };\n    };\n  };\n}\n```\n\n```nix\n# home.nix\n{pkgs, ...}: {\n  nvim-nix = {\n    enable = true;\n    theme.name = \"gruvbox\";\n    theme.flavour = \"light\"; # Set vim.opt.background.\n    version = \"nightly\";\n  };\n}\n```\n\n## Philosophy\n\n- Manage plugins + external dependencies using Nix\n  (managing plugins shouldn't be the responsibility of a plugin).\n- Configuration entirely in Lua[^1] (Vimscript is also possible).\n  This makes it easy to migrate from non-nix dotfiles.\n- Usable on any device with Neovim and Nix installed.\n- Ability to create multiple derivations with different sets of plugins.\n- Use either nixpkgs or flake inputs as plugin source.\n- Use Neovim's built-in loading mechanisms.\n  - See [`:h initializaion`](https://neovim.io/doc/user/starting.html#initialization)\n    and [`:h runtimepath`](https://neovim.io/doc/user/options.html#'runtimepath').\n- Use Neovim's built-in LSP client.\n\n[^1]: The absence of a Nix module DSL for Neovim configuration is deliberate.\n      If you were to copy the `nvim` directory to `$XDG_CONFIG_HOME`,\n      and install the plugins, it would work out of the box.\n\n## Initialization Order\n\nThis derivation creates an `init.lua` as follows:\n\n1. Add `nvim/lua` to the `runtimepath`.\n1. Add the content of `nvim/init.lua`.\n1. Add `nvim/*` to the `runtimepath`.\n1. Add `nvim/after` to the `runtimepath`.\n\nThis means that modules in `nvim/lua` can be `require`d in `init.lua` and\n`nvim/*/*.lua`.\n\nModules in `nvim/plugin/` are sourced automatically, as if they were plugins.\nBecause they are added to the runtime path at the end of the resulting\n`init.lua`, Neovim sources them _after_ loading plugins.\n\n## Bonus: bundle the neovim package into an executable\n\nYou can use\n[nix-portable](https://github.com/DavHau/nix-portable?tab=readme-ov-file#bundle-programs)\nto bundle the derivation into a dependency-free executable.\n\n```nix\nnix bundle --bundler github:DavHau/nix-portable -o bundle\n```\n\nYou still need nix to generate the bundle, but then you can simply pass around\nthe generated `./bundle/bin/nvim` wherever you want and execute your nvim\npackage!\n\nMake sure that the target machine has no conflicting nvim configuration. Have a\nlook at `~/.config/nvim`, `~/.local/share/nvim` and `~/.local/state/nvim`, and\nremove those directories if you have any conflict (make sure to make a backup\nbefore if you have important data there).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierrot-lc%2Fnvim-nix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpierrot-lc%2Fnvim-nix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierrot-lc%2Fnvim-nix/lists"}