Skip to content

Commit 664cde8

Browse files
author
Casey Fryer
committed
v1 release
1 parent f05562e commit 664cde8

File tree

10 files changed

+204
-144
lines changed

10 files changed

+204
-144
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Jordan
3+
Copyright (c) 2023 Casey
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 78 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,86 @@
11
# neovim-flake
22

3-
![ci-badge](https://img.shields.io/static/v1?label=Built%20with&message=Garnix&color=blue&style=flat&logo=nixos&link=https://garnix.io&labelColor=111212)
3+
Nix flake for [neovim](https://neovim.io/) that closely follows the [LazyVim](https://www.lazyvim.org) configuration.
44

5-
Nix flake for [neovim](https://neovim.io/) with configuration options highly focused on Scala 3.
6-
7-
![screenshot-1](./docs/screenshot-1.png)
8-
9-
![screenshot-2](./docs/screenshot-2.png)
5+
It is usable as a nixpkgs overlay, a home-manager module, or as a stand-alone nix flake.
6+
This is a bit of an experiment as a personal project. I am unlikely to fix any issues, beyond ones that affect me personally.
107

8+
![screenshot-1](./screenshot_1.png)
119
## Documentation
10+
### try it out
11+
```
12+
nix run github:cwfryer/neovim-flake .#default
13+
```
14+
By default, this includes all the LazyVim keybinds, autocmds, and settings.
15+
It also includes LSP support for Lua, Nix, and Rust (via [rust-tools](https://github.com/simrat39/rust-tools.nvim)).
16+
### nixpkgs overlay
17+
This flake outputs an overlay that replaces the nix-community/neovim-nightly-overlay with this neovim package.
18+
To use it in your flake config:
19+
```
20+
{
21+
inputs = {
22+
#... other inputs here...
23+
neovim-nightly = {
24+
url = "github:nix-community/neovim-nightly-overlay";
25+
inputs.nixpkgs.follows = "nixpkgs";
26+
};
27+
neovim-flake = {
28+
url = github:cwfryer/neovim-flake;
29+
inputs.nixpkgs.follows = "nixpkgs";
30+
};
31+
};
32+
outputs = {
33+
nixosConfigurations = {
34+
"<your_hostname"> = nixpkgs.lib.nixosSystem {
35+
nixpkgs = {
36+
overlays = [
37+
inputs.neovim-flake.overlays.default
38+
#... your other overlays ...
39+
];
40+
};
41+
#... more nix config ...
42+
environment.systemPackages = with pkgs; [
43+
#... your packages ...
44+
neovim-nightly
45+
];
46+
}
47+
};
48+
};
49+
}
50+
```
51+
You can also overlay nixpkgs in your home-manager configuration. It works basically the same as above. But... you should just the home-manager module below.
1252

13-
- [https://gvolpe.com/neovim-flake](https://gvolpe.com/neovim-flake).
14-
53+
### home-manager module (recommended)
54+
The best option is to use the home-manager module.
55+
Add the input flake:
56+
```
57+
{
58+
neovim-flake = {
59+
url = github:gvolpe/neovim-flake;
60+
inputs.nixpkgs.follows = "nixpkgs";
61+
};
62+
}
63+
```
64+
Import the home-manager module:
65+
```
66+
{
67+
imports = [ neovim-flake.nixosModules."<your_system>".hm ];
68+
}
69+
```
70+
Add the module to your home-manager config:
71+
```
72+
{
73+
programs.neovim-ide = {
74+
enable = true;
75+
settings = {
76+
#... your options ...
77+
};
78+
}
79+
}
80+
```
1581
## Credits
82+
Mostly based on Gabriel Volpe's [neovim-flake](https://github.com/gvolpe/neovim-flake).
83+
Which was based on Jordan Isaacs' [neovim-flake](https://github.com/jordanisaacs/neovim-flake), which was based on Wil Taylor's [neovim-flake](https://github.com/wiltaylor/neovim-flake).
1684

17-
Originally based on Jordan Isaacs' [neovim-flake](https://github.com/jordanisaacs/neovim-flake).
85+
All 3 of these are great references to see how to use a flake to build your flavor of Neovim.
86+
The vim configuration is largely based on the oustanding [LazyVim](https://www.lazyvim.org).

flake.lock

Lines changed: 17 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
1010
neovim-nightly-overlay.inputs.nixpkgs.follows = "nixpkgs";
1111

12-
tree-sitter = {
13-
url = github:tree-sitter/tree-sitter;
14-
flake = false;
15-
};
16-
1712
#-------------------------------------
1813
# Coding Plugins
1914
#-------------------------------------
@@ -177,14 +172,18 @@
177172
url = github:simrat39/rust-tools.nvim;
178173
flake = false;
179174
};
175+
inc-rename = {
176+
url = github:smjonas/inc-rename.nvim;
177+
flake = false;
178+
};
180179

181180
#-------------------------------------
182181
# Treesitter Plugins
183182
#-------------------------------------
184-
nvim-treesitter = {
185-
url = github:nvim-treesitter/nvim-treesitter;
186-
flake = false;
187-
};
183+
/* nvim-treesitter = { */
184+
/* url = github:nvim-treesitter/nvim-treesitter; */
185+
/* flake = false; */
186+
/* }; */
188187
nvim-treesitter-textobjects = {
189188
url = github:nvim-treesitter/nvim-treesitter-textobjects;
190189
flake = false;

lib/buildPlugin.nix

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,7 @@ with builtins;
88
let
99
inherit (prev.vimUtils) buildVimPluginFrom2Nix;
1010

11-
ts = prev.tree-sitter.override {
12-
# extraGrammars = {
13-
# tree-sitter-scala = final.tree-sitter-scala-master;
14-
# tree-sitter-tsx = final.tree-sitter-tsx-master;
15-
# tree-sitter-typescript = final.tree-sitter-tsx-master;
16-
# };
17-
};
18-
19-
treesitterGrammars = ts.withPlugins (p: [
11+
treeSitterPlug = pkgs.vimPlugins.nvim-treesitter.withPlugins (p: [
2012
p.tree-sitter-c
2113
p.tree-sitter-nix
2214
p.tree-sitter-python
@@ -33,26 +25,22 @@ let
3325
p.tree-sitter-graphql
3426
p.tree-sitter-json
3527
p.tree-sitter-go
28+
p.tree-sitter-lua
29+
p.tree-sitter-markdown-inline
30+
p.tree-sitter-bash
31+
p.tree-sitter-regex
32+
p.tree-sitter-vim
3633
]);
3734

38-
tsPostPatchHook = ''
39-
rm -r parser
40-
ln -s ${treesitterGrammars} parser
41-
'';
42-
4335
buildPlug = name:
4436
buildVimPluginFrom2Nix {
4537
pname = name;
4638
version = "master";
4739
src = builtins.getAttr name inputs;
48-
postPatch = ''
49-
${writeIf (name == "nvim-treesitter") tsPostPatchHook}
50-
'';
5140
};
5241

5342
vimPlugins = {
54-
inherit (pkgs.vimPlugins) nerdcommenter;
55-
# inherit vim-scala3;
43+
inherit treeSitterPlug;
5644
};
5745
in
5846
{

lib/hm.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ with lib; {
99
meta.maintainers = [ maintainers.cfryer ];
1010

1111
options.programs.neovim-ide = {
12-
enable = mkEnableOption "NeoVim with LSP enabled for Haskell, Rust and more.";
12+
enable = mkEnableOption "NeoVim with LazyVim config recreated in nix";
1313

1414
settings = mkOption {
1515
type = types.attrsOf types.anything;

0 commit comments

Comments
 (0)