Skip to content

Commit 64cbd0f

Browse files
authored
template/standalone: split into wiring and actual configuration (#1761)
Also makes it actually valid, and adds an example for setting Neovim builtin options.
1 parent 118286c commit 64cbd0f

3 files changed

Lines changed: 64 additions & 57 deletions

File tree

docs/manual/release-notes/rl-26.12.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99

1010
[snoweuph](https://github.com/snoweuph)
1111

12-
- splitting `languages/json5` from `languages/json`, because most `json` and
12+
- Split standalone flake template, into flake wiring and actual configuration.
13+
Also added example for Neovim builtin options and made the flake actually
14+
valid.
15+
16+
- Splitting `languages/json5` from `languages/json`, because most `json` and
1317
`jsonc` tools don't support it correctly, making it a bad fit to be combined
1418
into one module, because it creates scenarios where tools are connected to non
1519
supported filetypes.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# A module to be evaluated via lib.evalModules inside nvf's module system.
2+
# All options supported by nvf will go under config.vim to create the final
3+
# wrapped package. You may also add some new *options* under options.* to
4+
# expand the module system.
5+
{
6+
# You may browse available options for nvf on the online manual. Please see
7+
# <https://notashelf.github.io/nvf/options.html>
8+
config.vim = {
9+
theme.enable = true;
10+
11+
# You may want to configure builtin options of Neovim
12+
options = {
13+
# Allows for project-local configuration
14+
# <https://neovim.io/doc/user/options/#'exrc'>
15+
exrc = true;
16+
secure = true;
17+
};
18+
19+
lsp = {
20+
# Enable LSP functionality globally. This is required for modules found
21+
# in `vim.languages` to enable relevant LSPs.
22+
enable = true;
23+
24+
# You may define your own LSP configurations using `vim.lsp.servers` in
25+
# nvf without ever needing lspconfig to do it. This will use the native
26+
# API provided by Neovim > 0.11
27+
servers = {};
28+
};
29+
30+
# Language support and automatic configuration of companion plugins.
31+
# Note that enabling, e.g., languages.<lang>.diagnostics will automatically
32+
# enable top-level options such as enableLSP or enableExtraDiagnostics as
33+
# they are needed.
34+
languages = {
35+
enableFormat = true;
36+
enableTreesitter = true;
37+
enableExtraDiagnostics = true;
38+
39+
# Nix language and diagnostics.
40+
nix.enable = true;
41+
};
42+
};
43+
}

flake/templates/standalone/flake.nix

Lines changed: 16 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,71 +4,31 @@
44
nvf.url = "github:notashelf/nvf";
55
};
66

7-
outputs = {
8-
self,
9-
nixpkgs,
10-
...
11-
} @ inputs: let
7+
outputs = {nixpkgs, ...} @ inputs: let
128
# An abstraction over systems to easily provide the same package
139
# for multiple systems. This is preferable to abstraction libraries.
14-
forEachSystem = nixpkgs.lib.genAttrs ["x86_64-linux"];
10+
forEachSystem = nixpkgs.lib.genAttrs [
11+
"x86_64-linux"
12+
"aarch64-linux"
13+
];
1514
in {
1615
packages = forEachSystem (system: let
1716
pkgs = inputs.nixpkgs.legacyPackages.${system};
18-
19-
# A module to be evaluated via lib.evalModules inside nvf's module system.
20-
# All options supported by nvf will go under config.vim to create the final
21-
# wrapped package. You may also add some new *options* under options.* to
22-
# expand the module system.
23-
configModule = {
24-
# You may browse available options for nvf on the online manual. Please see
25-
# <https://notashelf.github.io/nvf/options.html>
26-
config.vim = {
27-
theme.enable = true;
28-
29-
lsp = {
30-
# Enable LSP functionality globally. This is required for modules found
31-
# in `vim.languages` to enable relevant LSPs.
32-
enable = true;
33-
34-
# You may define your own LSP configurations using `vim.lsp.servers` in
35-
# nvf without ever needing lspconfig to do it. This will use the native
36-
# API provided by Neovim > 0.11
37-
servers = {};
38-
};
39-
40-
# Language support and automatic configuration of companion plugins.
41-
# Note that enabling, e.g., languages.<lang>.diagnostics will automatically
42-
# enable top-level options such as enableLSP or enableExtraDiagnostics as
43-
# they are needed.
44-
languages = {
45-
enableFormat = true;
46-
enableTreesitter = true;
47-
enableExtraDiagnostics = true;
48-
49-
# Nix language and diagnostics.
50-
nix.enable = true;
51-
};
52-
};
53-
};
54-
55-
# Evaluate any and all modules to create the wrapped Neovim package.
56-
neovimConfigured = inputs.nvf.lib.neovimConfiguration {
57-
inherit pkgs;
58-
59-
modules = [
60-
# Configuration module to be imported. You may define multiple modules
61-
# or even import them from other files (e.g., ./modules/lsp.nix) to
62-
# better modularize your configuration.
63-
configModule
64-
];
65-
};
6617
in {
6718
# Packages to be exposed under packages.<system>. Those can accessed
6819
# directly from package outputs in other flakes if this flake is added
6920
# as an input. You may run those packages with 'nix run .#<package>'
70-
default = self.packages.${system}.neovim;
71-
neovimConfigured = neovimConfigured.neovim;
21+
default =
22+
(inputs.nvf.lib.neovimConfiguration {
23+
inherit pkgs;
24+
25+
modules = [
26+
# Configuration module to be imported. You may define multiple modules
27+
# or even import them from other files (e.g., ./modules/lsp.nix) to
28+
# better modularize your configuration.
29+
./configuration.nix
30+
];
31+
}).neovim;
7232
});
7333
};
7434
}

0 commit comments

Comments
 (0)