blob: 174275c7609ad2bb33d6c9ef415df246806e20f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
---
title: Usage
---
# {{ $frontmatter.title }}
Add the flake input
```nix
mnw.url = "github:Gerg-L/mnw";
```
or fetch this repo and then import the `default.nix`
Then use one of the [modules](#modules) or `mnw.lib.wrap`
### Wrapper function
The wrapper takes two arguments:
- A valid instance of `pkgs`. Or an attrset of `specialArgs` which must contain
`pkgs`
- A module containing your config
```nix
mnw.lib.wrap pkgs {
# Your config
};
```
Or if your config is a separate file
```nix
neovim = mnw.lib.wrap pkgs ./config.nix;
```
Or if you want to pass `specialArgs` to your module
```nix
neovim = mnw.lib.wrap {
inherit inputs pkgs;
myLib = self.lib;
} ./config.nix;
```
> [!TIP]
> `mnw.lib.wrap` uses `evalModules`, so you can use the full module system
Then add it to `environment.systemPackages` or `users.users.<name>.packages` or
anywhere you can add a package
### Modules
Import `mnw.<module>.mnw` into your config
Where `<module>` is:
`nixosModules` for NixOS,
`darwinModules` for nix-darwin
`homeManagerModules`for home-manager
Then use the `programs.mnw` options
```nix
programs.mnw = {
enable = true;
#config options
};
# or
programs.mnw = ./config.nix;
```
> [!TIP]
> `programs.mnw` is a submodule so you can use the fully module system
and mnw will install the wrapped neovim to `environment.systemPackages` or
`home.packages`
Alternatively set `programs.mnw.enable = false;` and add
`config.programs.mnw.finalPackage` where you want manually
### Dev mode
To setup hot reloading for quicker neovim config iteration:
Put your config plugin in `plugins.dev`,
```nix
plugins = {
dev.myconfig = {
pure = "myconfig";
impure = "/home/user/nix-config/nvim";
};
};
```
Then you can use the `.devMode` attribute of the created neovim package
For example `nix shell .#neovim.devMode` or
`nix shell .#nixosConfigurations.hostname.config.programs.mnw.finalPackage.devMode`
Which allows you to make changes to your neovim config without rebuilding your
system/home-manager/neovim (you still have to restart your neovim)
See the [examples](./examples)
### Lua variables
Currently mnw only has one lua global variable set
`mnw` which is a table which contains `configDir`
Which is the path to the generated config directory of mnw
You can build/view this directory by building the `.configDir` of the mnw
package
|