Skip to content

Commit e035d22

Browse files
committed
standalone: Expose options
This can be used to teach `nixd` about NixVim options.
1 parent 2705ce0 commit e035d22

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

docs/modules/standalone.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,16 @@ The `config` used to produce a standalone nixvim derivation can be accessed as a
5555

5656
This may be useful if you want unrelated parts of your NixOS or home-manager configuration to use the same value as something in your nixvim configuration.
5757

58+
## Accessing nixvim options
59+
60+
Given a nixvim derivation it is possible to access the module options using `<derivation>.options`.
61+
This can be useful to configure `nixd` for example:
62+
63+
```nix
64+
plugins.lsp.servers.nixd = {
65+
enable = true;
66+
settings = {
67+
options.nixvim.expr = ''(builtins.getFlake "/path/to/flake").packages.${system}.neovimNixvim.options'';
68+
};
69+
};
70+
```

wrappers/standalone.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ let
4444
mkNvim =
4545
mod:
4646
let
47-
config = handleAssertions (mkEval mod).config;
47+
evaledModule = mkEval mod;
48+
config = handleAssertions evaledModule.config;
4849
in
4950
(pkgs.symlinkJoin {
5051
name = "nixvim";
@@ -56,6 +57,7 @@ let
5657
})
5758
// {
5859
inherit config;
60+
inherit (evaledModule) options;
5961
nixvimExtend =
6062
extension:
6163
mkNvim {

0 commit comments

Comments
 (0)