Merge branch 'main' into add-hcl-not-terraform

This commit is contained in:
ppenguin 2024-10-31 17:28:28 +01:00
commit 037075f52d
No known key found for this signature in database
GPG key ID: 7E7143B546BB17A7
36 changed files with 846 additions and 525 deletions

View file

@ -16,7 +16,7 @@ If you have any questions regarding those files, feel free to open an issue or [
## Contributing
The contribution process is mostly documented in the [pull request template](.github/pull_request_template.md). You will find a checklist of items to complete before submitting a pull request. Please make sure you complete it before submitting a pull request. If you are unsure about any of the items, please ask.
The contribution process is mostly documented in the [pull request template](pull_request_template.md). You will find a checklist of items to complete before submitting a pull request. Please make sure you complete it before submitting a pull request. If you are unsure about any of the items, please ask.
### Guidelines

View file

@ -1,39 +0,0 @@
# Description
A clear and concise description of the aim of your Pull Request.
**If your pull request aims to fix an open issue or a present bug, please link the relevant issue below. If not, please remove this section**
Fixes #(issue)
## Type of change
Please delete any options that are not relevant.
- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
- Translation/Language update
- Docs
- Other
## Checklist
Please try to check at least a majority of the checklist before opening your pull request. Exceptions to this will be reviewed on a case by case basis.
- [ ] My code follows the style and contributing guidelines of this project.
- [ ] I ran Alejandra to format my code (`nix fmt`).
- [ ] I have performed a self-review of my own code and tested it.
- [ ] I have commented my code, particularly in hard-to-understand areas.
- [ ] My changes generate no new warnings.
- [ ] This change requires a documentation update.
- [ ] I have updated the documentation accordingly.
## Screenshots & Logs
You are kindly requested to attach screenshots of your changes in actions and preferably your build/run logs for all available packages. If you are not sure how to do this, you can refer to the [documentation](https://notashelf.github.io/neovim-flake/).
**Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.**
```console
# Paste your logs here
```

196
.github/README.md vendored
View file

@ -33,10 +33,9 @@
<div align="center">
<a>
A highly modular, configurable, extensible and easy to use Neovim configuration
framework in Nix. Designed for flexibility and ease of use, this flake
allows you to easily configure your Neovim instance with a few lines of
Nix code.
nvf is a highly modular, configurable, extensible and easy to use Neovim configuration
in Nix. Designed for flexibility and ease of use, nvf allows you to easily configure
your fully featured Neovim instance with a few lines of Nix.
</a>
</div>
@ -44,6 +43,7 @@
<div align="center"><p>
[Features]: #features
[Get Started]: #get-started
[Documentation]: #documentation
[Help]: #help
@ -51,119 +51,156 @@
[FAQ]: #faq
[Credits]: #credits
**[<kbd><br>Get Started<br></kbd>][Get Started]**
**[<kbd><br>Documentation<br></kbd>][Documentation]**
**[<kbd><br>Help<br></kbd>][Help]**
**[<kbd><br>Contribute<br></kbd>][Contribute]**
**[<kbd><br>FAQ<br></kbd>][Faq]**
**[<kbd><br>Credits<br></kbd>][Credits]**
**[<kbd><br>Features <br></kbd>][Features]**
**[<kbd><br>Get Started<br></kbd>][Get Started]**
**[<kbd><br>Documentation<br></kbd>][Documentation]**
**[<kbd><br>Help<br></kbd>][Help]**
**[<kbd><br>Contribute<br></kbd>][Contribute]**
**[<kbd><br>FAQ<br></kbd>][Faq]** **[<kbd><br>Credits<br></kbd>][Credits]**
</p></div>
---
## Features
- **Reproducible**: Your configuration will behave the same _anywhere_. No
surprises, promise!
- **Portable**: nvf depends _solely_ on your Nix store, and nothing else. No
more global binaries! Works on all platforms, without hassle.
- **Customizable**: There are _almost no defaults_ to annoy you. nvf is fully
customizable through the Nix module system.
- **Well-documented**: Documentation is priority. You will _never_ face
undocumented, obscure behaviour.
- **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and
will, remain maintainable for myself and any contributors.
## Get Started
### Using `nix` CLI
[nvf manual]: https://notashelf.github.io/nvf/
[issue tracker]: https://github.com/NotAShelf/nvf/issues
If you would like to try out the configuration before even thinking about
installing it, you can run the following command
If you are not sold on the concepts of **nvf**, and would like to try out the
default configuration before even _thinking about_ installing it, you may run
the following in order to take **nvf** out for a spin.
```console
```bash
# Run the default package
nix run github:notashelf/nvf
```
This will get you a feel for the base configuration and UI design.
The flake exposes `#nix` as the default package, providing minimal
language support and various utilities.You may also use `#nix`,
`#tidal` or `#maximal` to get try out different configurations.
This will get you a feel for the base configuration and UI design. Though, none
of the configuration options are final as **nvf** is designed to be modular and
configurable.
It is as simple as changing the target output to get a different
configuration. For example, to get a configuration with `tidal` support, run:
> [!TIP]
> The flake exposes `#nix` as the default package, providing minimal language
> support and various utilities. You may also use the `#nix` or `#maximal`
> packages provided by the this flake to get try out different configurations.
```console
nix run github:notashelf/nvf#tidal
It is as simple as changing the target output to get a different configuration.
For example, to get a configuration with large language coverage, run:
```bash
# Run the maximal package
nix run github:notashelf/nvf#maximal
```
Similar instructions will apply for `nix profile install`. However, you are
recommended to instead use the module system as described in the manual.
> [!NOTE]
> The `maximal` configuration is _massive_ and will take a while to build.
> To get a feel for the configuration, use the default `nix` or `tidal`
> configurations. Should you choose to try out the `maximal` configuration,
> using the binary cache as described in the manual is _strongly_ recommended.
> The `maximal` configuration is quite large, and might take a while to build.
> To get a feel for the configuration, use the default `nix` configuration.
> Should you choose to try out the `maximal` configuration, using the binary
> cache as described in the manual is _strongly_ recommended.
If you are convinced, proceed to the next section to view the installation
instructions.
## Documentation
See the [**nvf** Manual](https://notashelf.github.io/nvf/) for
detailed installation guides, configurations, available options, release notes
and more. Tips for installing userspace plugins is also contained in the
documentation.
The _recommended_ way of installing **nvf** is using either the NixOS or the
Home-Manager module, though it is completely possible and no less supported to
install **nvf** as a standalone package, or a flake output.
If you want to dive right into trying **nvf** you can get a fully
featured configuration with `nix` language support by running:
See the rendered [nvf manual] for detailed and up-to-date installation guides,
configurations, available options, release notes and more. Tips for installing
userspace plugins is also contained in the documentation.
```console
nix run github:notashelf/nvf#nix
```
> [!TIP]
> While using NixOS or Home-Manager modules,
> `programs.nvf.enableManpages = true;` will allow you to view option
> documentation from the comfort of your terminal via `man 5 nvf`. The more you
> know.
[Issues]: https://github.com/NotAShelf/nvf/issues
Please create an issue on the [issue tracker](issues) if you find
the documentation lacking or confusing. I also appreciate any contributions
to the documentation.
Please create an issue on the [issue tracker] if you find the documentation
lacking or confusing. Any improvements to the documentation through pull
requests are also welcome, and appreciated.
## Help
You can create an issue on the [issue tracker](issues) to ask questions
or report bugs. I am not yet on spaces like matrix or IRC, so please use the issue
tracker for now.
You can create an issue on the [issue tracker] to ask questions or report bugs.
I am not yet on spaces like matrix or IRC, so please use the issue tracker for
now.
## Contributing
I am always looking for new ways to help improve this flake. If you would like
to contribute, please read the [contributing guide](CONTRIBUTING.md) before
submitting a pull request. You can also create an issue on the
[issue tracker](issues) before submitting a pull request if you would
like to discuss a feature or bug fix.
submitting a pull request. You can also create an issue on the [issue tracker]
before submitting a pull request if you would like to discuss a feature or bug
fix.
## FAQ
[appropriate issue template]: https://github.com/NotAShelf/nvf/issues/new/choose
[list of branches]: https://github.com/NotAShelf/nvf/branches
[list of open pull requests]: https://github.com/NotAShelf/nvf/pulls
**Q**: What platforms are supported?
<br/> **A**: nvf actively supports Linux and Darwin platforms using standalone
Nix, NixOS or Home-Manager. Please take a look at the
**Q**: Can you add _X_?
<br/>
**A**: Maybe! It is not one of our goals to support each and every Neovim
plugin, however, I am always open to new modules and plugin setup additions
to **nvf**. Use the [appropritate issue template](issues/new/choose) and I will
consider a module addition.
<br/> **A**: Maybe! It is not one of our goals to support each and every Neovim
plugin, however, I am always open to new modules and plugin setup additions to
**nvf**. Use the [appropriate issue template] and I will consider a module
addition. As mentioned before, PRs adding new features are also welcome.
**Q**: A plugin I need is not available in **nvf**. What to do?
<br/>
**A**: **nvf** exposes several APIs for you to be able to add your own
plugin configurations! Please see the documentation on how you may do
this.
<br/> **A**: **nvf** exposes several APIs for you to be able to add your own
plugin configurations! Please see the documentation on how you may do this.
**Q**: Main branch is awfully silent, is the project dead?
<br/>
**A**: No! Sometimes we branch out (e.g. v0.6) to avoid breaking userspace
and work in a separate branch until we make sure the new additions are
implemented in the most comfortable way available to the end user. If you have
not noticed any activity on the main branch, consider taking a look at the [list
of branches](https://github.com/NotAShelf/nvf/branches=) or the [list of open
pull requests](https://github.com/NotAShelf/nvf)
<br/> **A**: No! Sometimes we branch out (e.g. `v0.6`) to avoid breaking
userspace and work in a separate branch until we make sure the new additions are
implemented in the most comfortable way possible for the end user. If you have
not noticed any activity on the main branch, consider taking a look at the
[list of branches] or the [list of open pull requests]. You may also consider
_testing_ those release branches to get access to new features ahead of time and
better prepare to breaking changes.
## Credits
### Contributors
Special thanks to
Special, heart-felt thanks to
- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to work
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally possible
- [@horriblename](https://github.com/horriblename) - For actively implementing planned features and quality of life updates
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to
work
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally
possible
- [@horriblename](https://github.com/horriblename) - For actively implementing
planned features and quality of life updates
- [@Yavko](https://github.com/Yavko) - For the amazing **nvf** logo
- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I could not
- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I
could not
- [@Diniamo](https://github.com/Diniamo) - For actively submitting PRs, pull
requests and overall assistence
- [@Gerg-l](https://github.com/gerg-l) - For the modern Neovim wrapper, mnw and
occasional code improvements
and everyone who has submitted issues or pull requests!
@ -172,10 +209,18 @@ and everyone who has submitted issues or pull requests!
This configuration borrows from and is based on a few other configurations,
including:
- [@jordanisaacs's](https://github.com/jordanisaacs) [neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake is originally based on.
- [@sioodmy's](https://github.com/sioodmy) [dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design choices.
- [@wiltaylor's](https://github.com/wiltaylor) [neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and design ideas.
- [@gvolpe's](https://github.com/gvolpe) [neovim-flake](https://github.com/gvolpe/neovim-flake) for plugin, design and nix concepts.
- [@jordanisaacs's](https://github.com/jordanisaacs)
[neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake
is originally based on.
- [@sioodmy's](https://github.com/sioodmy)
[dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design
choices.
- [@wiltaylor's](https://github.com/wiltaylor)
[neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and
design ideas.
- [@gvolpe's](https://github.com/gvolpe)
[neovim-flake](https://github.com/gvolpe/neovim-flake) for plugin, design and
nix concepts.
I am grateful for their previous work and inspiration, and I wholeheartedly
recommend checking their work out.
@ -183,11 +228,14 @@ recommend checking their work out.
## License
Following the license of the [original neovim-flake](https://github.com/jordanisaacs/neovim-flake),
**nvf** has been made available under the [**MIT License**](LICENSE). However, all assets
and documentation are published under the
Following the license of the
[original neovim-flake](https://github.com/jordanisaacs/neovim-flake), **nvf**
has been made available under the [**MIT License**](LICENSE). However, all
assets and documentation are published under the
[**CC BY License**](https://github.com/NotAShelf/nvf/blob/main/.github/assets/LICENSE).
<h6 align="center">Yes, this includes the logo work too. Stop taking artwork that is not yours!</h6>
---
<div align="right">

57
.github/pull_request_template.md vendored Normal file
View file

@ -0,0 +1,57 @@
<!--
^ Please include a clear and concise description of the aim of your Pull Request above this line ^
For plugin dependency/module additions, please make sure to link the source link of the added plugin
or dependency in this section.
If your pull request aims to fix an open issue or a please bug, please also link the relevant issue
below this line. You may attach an issue to your pull request with `Fixes #<issue number>` outside
this comment.
-->
## Sanity Checking
<!--
Please check all that apply. As before, this section is not a hard requirement but checklists with more checked
items are likely to be merged faster. You may save some time in maintainer review by performing self-reviews here
before submitting your pull request.
If your pull request includes any change or unexpected behaviour not covered below, please do make sure to include
it above in your description.
-->
[editorconfig]: https://editorconfig.org
[changelog]: https://github.com/NotAShelf/nvf/tree/main/docs/release-notes
- [ ] I have updated the [changelog] as per my changes.
- [ ] I have tested, and self-reviewed my code.
- Style and consistency
- [ ] I ran **Alejandra** to format my code (`nix fmt`).
- [ ] My code conforms to the [editorconfig] configuration of the project.
- [ ] My changes are consistent with the rest of the codebase.
- If new changes are particularly complex:
- [ ] My code includes comments in particularly complex areas
- [ ] I have added a section in the manual.
- [ ] _(For breaking changes)_ I have included a migration guide.
- Package(s) built:
- [ ] `.#nix` (default package)
- [ ] `.#maximal`
- [ ] `.#docs-html`
- Tested on platform(s)
- [ ] `x86_64-linux`
- [ ] `aarch64-linux`
- [ ] `x86_64-darwin`
- [ ] `aarch64-darwin`
<!--
If your changes touch upon a portion of the codebase that you do not understand well, please make sure to consult
the maintainers on your changes. In most cases, making an issue before creating your PR will help you avoid duplicate
efforts in the long run.
-->
---
Add a :+1: [reaction] to [pull requests you find important].
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
[pull requests you find important]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc

22
.github/workflows/cleanup.yml vendored Normal file
View file

@ -0,0 +1,22 @@
name: Cleanup
on:
workflow_dispatch:
schedule:
- cron: "0 4 1 * *" # 4AM on 1st of every month
- cron: "0 4 15 * *" # 4AM on the 15th of every month
jobs:
branches:
name: Cleanup old branches
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Delete old branches"
uses: beatlabs/delete-old-branches-action@v0.0.10
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
date: "1 months ago"
dry_run: false
delete_tags: false
exclude_open_pr_branches: true

View file

@ -1,4 +1,5 @@
name: "Build and deploy documentation"
on:
workflow_dispatch:
push:
@ -7,6 +8,7 @@ on:
paths:
# build the manuals only when docs directory is updated
- docs/**
- modules/**
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
@ -20,23 +22,34 @@ concurrency:
cancel-in-progress: true
jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v4.1.7
- name: print latest_commit
run: echo ${{ github.sha }}
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
publish:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- uses: actions/checkout@v4.1.7
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build
run: |
nix build '.#docs'
- run: |
nix build .#docs
cp -r result/share/doc/nvf public
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
- uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public

View file

@ -19,6 +19,7 @@ isMaximal: {
lspsaga.enable = false;
trouble.enable = true;
lspSignature.enable = true;
otter-nvim.enable = isMaximal;
lsplines.enable = isMaximal;
nvim-docs-view.enable = isMaximal;
};
@ -53,12 +54,14 @@ isMaximal: {
ts.enable = isMaximal;
svelte.enable = isMaximal;
go.enable = isMaximal;
lua.enable = isMaximal;
elixir.enable = isMaximal;
zig.enable = isMaximal;
ocaml.enable = isMaximal;
python.enable = isMaximal;
dart.enable = isMaximal;
bash.enable = isMaximal;
r.enable = isMaximal;
tailwind.enable = isMaximal;
typst.enable = isMaximal;
clang = {
@ -154,7 +157,7 @@ isMaximal: {
};
utility = {
ccc.enable = isMaximal;
ccc.enable = false;
vim-wakatime.enable = false;
icon-picker.enable = isMaximal;
surround.enable = isMaximal;

View file

@ -2,131 +2,131 @@
inputs,
pkgs,
lib,
manpageUrls ? pkgs.path + "/doc/manpage-urls.json",
...
}: let
inherit (lib.modules) mkForce evalModules;
inherit (lib.strings) hasPrefix removePrefix;
inherit (lib.attrsets) isAttrs mapAttrs optionalAttrs recursiveUpdate isDerivation;
inherit (builtins) fromJSON readFile;
inherit ((lib.importJSON ../release.json)) release;
# release data
release-config = fromJSON (readFile ../release.json);
revision = release-config.release;
# From home-manager:
#
# Recursively replace each derivation in the given attribute set
# with the same derivation but with the `outPath` attribute set to
# the string `"\${pkgs.attribute.path}"`. This allows the
# documentation to refer to derivations through their values without
# establishing an actual dependency on the derivation output.
#
# This is not perfect, but it seems to cover a vast majority of use
# cases.
#
# Caveat: even if the package is reached by a different means, the
# path above will be shown and not e.g.
# `${config.services.foo.package}`.
scrubDerivations = prefixPath: attrs: let
scrubDerivation = name: value: let
pkgAttrName = prefixPath + "." + name;
in
if isAttrs value
then
scrubDerivations pkgAttrName value
// optionalAttrs (isDerivation value) {
outPath = "\${${pkgAttrName}}";
}
else value;
in
mapAttrs scrubDerivation attrs;
# Make sure the used package is scrubbed to avoid actually
# instantiating derivations.
scrubbedPkgsModule = {
imports = [
{
_module.args = {
pkgs = mkForce (scrubDerivations "pkgs" pkgs);
pkgs_i686 = mkForce {};
};
}
];
};
# Specify the path to the module entrypoint
nvimPath = toString ./..;
buildOptionsDocs = args @ {
modules,
includeModuleSystemOptions ? true,
warningsAreErrors ? true,
...
}: let
inherit ((evalModules {inherit modules;})) options;
# Declaration of the Github site URL.
# Takes a user, repo, and subpath, and returns a declaration site
# as a string.
githubDeclaration = user: repo: subpath: let
urlRef = "github.com";
branch = "main";
in {
url = "https://${urlRef}/${user}/${repo}/blob/${branch}/${subpath}";
name = "<${repo}/${subpath}>";
};
in
pkgs.buildPackages.nixosOptionsDoc ({
inherit warningsAreErrors;
options =
if includeModuleSystemOptions
then options
else builtins.removeAttrs options ["_module"];
transformOptions = opt:
recursiveUpdate opt {
# Clean up declaration sites to not refer to the nvf
# source tree.
declarations = map (decl:
if hasPrefix nvimPath (toString decl)
then
githubDeclaration "notashelf" "nvf"
(removePrefix "/" (removePrefix nvimPath (toString decl)))
else if decl == "lib/modules.nix"
then
# TODO: handle this in a better way (may require upstream
# changes to nixpkgs)
githubDeclaration "NixOS" "nixpkgs" decl
else decl)
opt.declarations;
};
}
// builtins.removeAttrs args ["modules" "includeModuleSystemOptions"]);
nvimModuleDocs = buildOptionsDocs {
nvimModuleDocs = pkgs.nixosOptionsDoc {
variablelistId = "nvf-options";
warningsAreErrors = true;
modules =
import ../modules/modules.nix {
inherit lib pkgs;
check = false;
}
++ [scrubbedPkgsModule];
inherit
(
(lib.evalModules {
modules =
import ../modules/modules.nix {
inherit lib pkgs;
}
++ [
(
let
# From nixpkgs:
#
# Recursively replace each derivation in the given attribute set
# with the same derivation but with the `outPath` attribute set to
# the string `"\${pkgs.attribute.path}"`. This allows the
# documentation to refer to derivations through their values without
# establishing an actual dependency on the derivation output.
#
# This is not perfect, but it seems to cover a vast majority of use
# cases.
#
# Caveat: even if the package is reached by a different means, the
# path above will be shown and not e.g.
# `${config.services.foo.package}`.
scrubDerivations = namePrefix: pkgSet:
builtins.mapAttrs (
name: value: let
wholeName = "${namePrefix}.${name}";
in
if builtins.isAttrs value
then
scrubDerivations wholeName value
// lib.optionalAttrs (lib.isDerivation value) {
inherit (value) drvPath;
outPath = "\${${wholeName}}";
}
else value
)
pkgSet;
in {
_module = {
check = false;
args.pkgs = lib.mkForce (scrubDerivations "pkgs" pkgs);
};
}
)
];
})
)
options
;
transformOptions = opt:
opt
// {
declarations =
map (
decl:
if lib.hasPrefix (toString ../.) (toString decl)
then
lib.pipe decl [
toString
(lib.removePrefix (toString ../.))
(lib.removePrefix "/")
(x: {
url = "https://github.com/NotAShelf/nvf/blob/main/${x}";
name = "<nvf/${x}>";
})
]
else if decl == "lib/modules.nix"
then {
url = "https://github.com/NixOS/nixpkgs/blob/master/${decl}";
name = "<nixpkgs/lib/modules.nix>";
}
else decl
)
opt.declarations;
};
};
# Generate the HTML manual pages
html = pkgs.callPackage ./manual.nix {
inherit release;
inherit (nvimModuleDocs) optionsJSON;
};
in {
inherit (inputs) nmd;
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
# `nixosOptionsDoc` is more customizable.
options.json =
pkgs.runCommand "options.json" {
meta.description = "List of nvf options in JSON format";
} ''
mkdir -p $out/{share/doc,nix-support}
cp -a ${nvimModuleDocs.optionsJSON}/share/doc/nixos $out/share/doc/nvf
substitute \
${nvimModuleDocs.optionsJSON}/nix-support/hydra-build-products \
$out/nix-support/hydra-build-products \
--replace \
'${nvimModuleDocs.optionsJSON}/share/doc/nixos' \
"$out/share/doc/nvf"
'';
# Generate the `man home-configuration.nix` package
nvf-configuration-manual =
manPages =
pkgs.runCommand "nvf-reference-manpage" {
nativeBuildInputs = [pkgs.buildPackages.installShellFiles pkgs.nixos-render-docs];
nativeBuildInputs = [
pkgs.buildPackages.installShellFiles
pkgs.nixos-render-docs
];
allowedReferences = ["out"];
} ''
# Generate manpages.
mkdir -p $out/share/man/man5
mkdir -p $out/share/man/man1
mkdir -p $out/share/man/{man5,man1}
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
--revision ${revision} \
--revision ${release} \
--header ${./man/header.5} \
--footer ${./man/footer.5} \
${nvimModuleDocs.optionsJSON}/share/doc/nixos/options.json \
@ -135,38 +135,8 @@
cp ${./man/nvf.1} $out/share/man/man1/nvf.1
'';
# Generate the HTML manual pages
nvf-manual = pkgs.callPackage ./manual.nix {
inherit revision manpageUrls;
outputPath = "share/doc/nvf";
options = {
nvf = nvimModuleDocs.optionsJSON;
};
manual = {
inherit html;
htmlOpenTool = pkgs.callPackage ./html-open-tool.nix {inherit html;};
};
html = nvf-manual;
htmlOpenTool = pkgs.callPackage ./html-open-tool.nix {} {inherit html;};
in {
inherit (inputs) nmd;
options = {
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
# `nixosOptionsDoc` is more customizable.
json =
pkgs.runCommand "options.json" {
meta.description = "List of nvf options in JSON format";
} ''
mkdir -p $out/{share/doc,nix-support}
cp -a ${nvimModuleDocs.optionsJSON}/share/doc/nixos $out/share/doc/nvf
substitute \
${nvimModuleDocs.optionsJSON}/nix-support/hydra-build-products \
$out/nix-support/hydra-build-products \
--replace \
'${nvimModuleDocs.optionsJSON}/share/doc/nixos' \
"$out/share/doc/nvf"
'';
};
manPages = nvf-configuration-manual;
manual = {inherit html htmlOpenTool;};
}

View file

@ -2,13 +2,9 @@
writeShellScriptBin,
makeDesktopItem,
symlinkJoin,
}: {
html,
pathName ? "nvf",
projectName ? pathName,
name ? "${pathName}-help",
}: let
helpScript = writeShellScriptBin name ''
helpScript = writeShellScriptBin "nvf-help" ''
set -euo pipefail
if [[ ! -v BROWSER || -z $BROWSER ]]; then
@ -24,20 +20,23 @@
echo "$0: unable to start a web browser; please set \$BROWSER"
exit 1
else
exec "$BROWSER" "${html}/share/doc/${pathName}/index.xhtml"
exec "$BROWSER" "${html}/share/doc/nvf/index.xhtml"
fi
'';
desktopItem = makeDesktopItem {
name = "${pathName}-manual";
desktopName = "${projectName} Manual";
genericName = "View ${projectName} documentation in a web browser";
name = "nvf-manual";
desktopName = "nvf Manual";
genericName = "View nvf documentation in a web browser";
icon = "nix-snowflake";
exec = "${helpScript}/bin/${name}";
exec = "${helpScript}/bin/nvf-help";
categories = ["System"];
};
in
symlinkJoin {
inherit name;
paths = [helpScript desktopItem];
name = "nvf-help";
paths = [
helpScript
desktopItem
];
}

View file

@ -4,11 +4,10 @@
# build inputs
nixos-render-docs,
documentation-highlighter,
path,
# nrd configuration
manpageUrls,
revision,
options,
outputPath ? "share/doc/nvf",
release,
optionsJSON,
}:
stdenvNoCC.mkDerivation {
name = "nvf-manual";
@ -20,9 +19,11 @@ stdenvNoCC.mkDerivation {
nativeBuildInputs = [nixos-render-docs];
buildPhase = ''
mkdir -p out/{highlightjs,media}
dest="$out/share/doc/nvf"
mkdir -p "$(dirname "$dest")"
mkdir -p $dest/{highlightjs,media}
cp -vt out/highlightjs \
cp -vt $dest/highlightjs \
${documentation-highlighter}/highlight.pack.js \
${documentation-highlighter}/LICENSE \
${documentation-highlighter}/mono-blue.css \
@ -31,38 +32,32 @@ stdenvNoCC.mkDerivation {
substituteInPlace ./options.md \
--subst-var-by \
OPTIONS_JSON \
${options.nvf}/share/doc/nixos/options.json
${optionsJSON}/share/doc/nixos/options.json
substituteInPlace ./manual.md \
--subst-var-by \
NVF_VERSION \
${revision}
${release}
# copy stylesheet
cp ${./static/style.css} out/style.css
cp ${./static/style.css} "$dest/style.css"
# copy release notes
cp -vr ${./release-notes} release-notes
# generate manual from
nixos-render-docs manual html \
--manpage-urls ${manpageUrls} \
--revision ${lib.trivial.revisionWithDefault revision} \
--manpage-urls ${path + "/doc/manpage-urls.json"} \
--revision ${lib.trivial.revisionWithDefault release} \
--stylesheet style.css \
--script highlightjs/highlight.pack.js \
--script highlightjs/loader.js \
--toc-depth 2 \
--section-toc-depth 1 \
manual.md \
out/index.xhtml
'';
"$dest/index.xhtml"
installPhase = ''
dest="$out/${outputPath}"
mkdir -p "$(dirname "$dest")"
mv out "$dest"
mkdir -p $out/nix-support/
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
mkdir -p $out/nix-support/
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
'';
}

View file

@ -5,16 +5,19 @@ can add code that relies on other code. However, if you don't know what the
entries are called, it's hard to do that, so here is a list of the internal
entries in nvf:
`vim.luaConfigRC` (top-level DAG):
## `vim.luaConfigRC` (top-level DAG) {#ch-vim-luaconfigrc}
1. (`luaConfigPre`) - not a part of the actual DAG, instead, it's simply
inserted before the rest of the DAG
2. `globalsScript` - used to set globals defined in `vim.globals`
3. `basic` - used to set basic configuration options
4. `theme` (this is simply placed before `pluginConfigs`, meaning that surrounding entries don't depend on it) - used to set up the theme, which has to be done before other plugins
5. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option,
see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your own
plugins) DAG, used to set up internal plugins
6. `extraPluginConfigs` - the result of `vim.extraPlugins`, which is not a
4. `optionsScript` - used to set options defined in `vim.o`
5. `theme` (this is simply placed before `pluginConfigs`, meaning that
surrounding entries don't depend on it) - used to set up the theme, which has
to be done before other plugins
6. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option,
see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your
own plugins) DAG, used to set up internal plugins
7. `extraPluginConfigs` - the result of `vim.extraPlugins`, which is not a
direct DAG, but is converted to, and resolved as one internally
7. `mappings` - the result of `vim.maps`
8. `mappings` - the result of `vim.maps`

View file

@ -80,13 +80,17 @@ everyone.
[ocaml-lsp]: https://github.com/ocaml/ocaml-lsp
[new-file-template.nvim]: https://github.com/otavioschwanck/new-file-template.nvim
[neo-tree.nvim]: https://github.com/nvim-neo-tree/neo-tree.nvim
- Add [ocaml-lsp] support
- Fix "Emac" typo
- Add [new-file-template.nvim] to automatically fill new file contents using
templates.
templates
- Make [neo-tree.nvim] display file icons properly by enabling
`visuals.nvimWebDevicons`
[diniamo](https://github.com/diniamo):
@ -108,6 +112,7 @@ everyone.
plugin's options can now be found under `indentBlankline.setupOpts`, the
previous iteration of the module also included out of place/broken options,
which have been removed for the time being. These are:
- `listChar` - this was already unused
- `fillChar` - this had nothing to do with the plugin, please configure it
yourself by adding `vim.opt.listchars:append({ space = '<char>' })` to your
@ -186,8 +191,28 @@ everyone.
- Add [python-lsp-server](https://github.com/python-lsp/python-lsp-server) as an
additional Python LSP server.
- Add [](#opt-vim.options) to set `vim.o` values in in your nvf configuration
without using additional Lua. See option documentation for more details.
- Add [](#opt-vim.dashboard.dashboard-nvim.setupOpts) to allow user
configuration for [dashboard.nvim](https://github.com/nvimdev/dashboard-nvim)
- Update `lualine.nvim` input and add missing themes:
- Adds `ayu`, `gruvbox_dark`, `iceberg`, `moonfly`, `onedark`,
`powerline_dark` and `solarized_light` themes.
[ppenguin](https://github.com/ppenguin):
- Telescope:
- Fixed `project-nvim` command and keybinding
- Added default ikeybind/command for `Telescope resume` (`<leader>fr`)
[Soliprem](https://github.com/Soliprem):
- Add LSP and Treesitter support for R under `vim.languages.R`.
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
ccc
[Bloxx12](https://github.com/Bloxx12):
- Fix internal breakage in `elixir-tools` setup.

View file

@ -1,21 +1,5 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
@ -52,21 +36,6 @@
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"mnw": {
"locked": {
"lastModified": 1726188505,
@ -129,11 +98,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1726142289,
"narHash": "sha256-Jks8O42La+nm5AMTSq/PvM5O+fUAhIy0Ce1QYqLkyZ4=",
"lastModified": 1726871744,
"narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "280db3decab4cbeb22a4599bd472229ab74d25e1",
"rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2",
"type": "github"
},
"original": {
@ -171,22 +140,6 @@
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1702350026,
"narHash": "sha256-A+GNZFZdfl4JdDphYKBJ5Ef1HOiFsP18vQe9mqjmUis=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9463103069725474698139ab10f17a9d125da859",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nmd": {
"flake": false,
"locked": {
@ -846,11 +799,11 @@
"plugin-lualine": {
"flake": false,
"locked": {
"lastModified": 1712310396,
"narHash": "sha256-WcH2dWdRDgMkwBQhcgT+Z/ArMdm+VbRhmQftx4t2kNI=",
"lastModified": 1723473562,
"narHash": "sha256-gCm7m96PkZyrgjmt7Efc+NMZKStAq1zr7JRCYOgGDuE=",
"owner": "hoob3rt",
"repo": "lualine.nvim",
"rev": "0a5a66803c7407767b799067986b4dc3036e1983",
"rev": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056",
"type": "github"
},
"original": {
@ -910,11 +863,11 @@
"plugin-neo-tree-nvim": {
"flake": false,
"locked": {
"lastModified": 1713050882,
"narHash": "sha256-cZwOVpdMT0NCtp6Ha592QA2RzKVS6LhXXcjfDBCQ+0k=",
"lastModified": 1726542367,
"narHash": "sha256-Lqt0KJNT9HmpJwZoWChYeVBrDWhscRe8COqVCwgcTwk=",
"owner": "nvim-neo-tree",
"repo": "neo-tree.nvim",
"rev": "22e566aeb075c94f670f34077e05ba95190dfb4a",
"rev": "a77af2e764c5ed4038d27d1c463fa49cd4794e07",
"type": "github"
},
"original": {
@ -1183,11 +1136,11 @@
"plugin-nvim-lspconfig": {
"flake": false,
"locked": {
"lastModified": 1716498901,
"narHash": "sha256-PMMqPDnq4Q8gWeKQ2WPE+pOf1R1G61wJ+bAWkHpQlzE=",
"lastModified": 1727085470,
"narHash": "sha256-IPpUZEMIL7+4mmqQLy9JeT0cW15/SH3Hx8kyksVcqC0=",
"owner": "neovim",
"repo": "nvim-lspconfig",
"rev": "b972e7154bc94ab4ecdbb38c8edbccac36f83996",
"rev": "dd329912c8d446240584a2dbcd3802af3a19105a",
"type": "github"
},
"original": {
@ -1327,11 +1280,11 @@
"plugin-nvim-treesitter-context": {
"flake": false,
"locked": {
"lastModified": 1716388265,
"narHash": "sha256-EY5Si6t7LXcxOP3ubGAAMd3lgbeaCOCIybSKi1Ucx98=",
"lastModified": 1726947805,
"narHash": "sha256-5oN/vyhSqDqjLEzECj01A7A+Yq7U1H1HXLbzkC1Ljqw=",
"owner": "nvim-treesitter",
"repo": "nvim-treesitter-context",
"rev": "f62bfe19e0fbc13ae95649dfb3cf22f4ff85b683",
"rev": "3d5390c49e3f8fe457b376df2a49aa39d75b7911",
"type": "github"
},
"original": {
@ -1420,6 +1373,22 @@
"type": "github"
}
},
"plugin-otter-nvim": {
"flake": false,
"locked": {
"lastModified": 1724585935,
"narHash": "sha256-euHwoK2WHLF/hrjLY2P4yGrIbYyBN38FL3q4CKNZmLY=",
"owner": "jmbuhr",
"repo": "otter.nvim",
"rev": "ca9ce67d0399380b659923381b58d174344c9ee7",
"type": "github"
},
"original": {
"owner": "jmbuhr",
"repo": "otter.nvim",
"type": "github"
}
},
"plugin-oxocarbon": {
"flake": false,
"locked": {
@ -1908,6 +1877,7 @@
"plugin-obsidian-nvim": "plugin-obsidian-nvim",
"plugin-onedark": "plugin-onedark",
"plugin-orgmode-nvim": "plugin-orgmode-nvim",
"plugin-otter-nvim": "plugin-otter-nvim",
"plugin-oxocarbon": "plugin-oxocarbon",
"plugin-plenary-nvim": "plugin-plenary-nvim",
"plugin-project-nvim": "plugin-project-nvim",
@ -1933,8 +1903,7 @@
"plugin-vim-vsnip": "plugin-vim-vsnip",
"plugin-which-key": "plugin-which-key",
"rnix-lsp": "rnix-lsp",
"systems": "systems_2",
"zig": "zig"
"systems": "systems_2"
}
},
"rust-overlay": {
@ -2006,26 +1975,6 @@
"repo": "flake-utils",
"type": "github"
}
},
"zig": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1716725305,
"narHash": "sha256-LIz08gALt2wlutGXAEhNroEoIuPV5ePQB8LI4WzXcy8=",
"owner": "mitchellh",
"repo": "zig-overlay",
"rev": "93b02a697561ecd438cfa5779727b5a1c300cb4c",
"type": "github"
},
"original": {
"owner": "mitchellh",
"repo": "zig-overlay",
"type": "github"
}
}
},
"root": "root",

View file

@ -13,8 +13,8 @@
inherit inputs;
specialArgs = {inherit lib;};
} {
# provide overridable systems
# https://github.com/nix-systems/nix-systems
# Allow users to bring their own systems.
# «https://github.com/nix-systems/nix-systems»
systems = import inputs.systems;
imports = [
./flake/apps.nix
@ -62,7 +62,6 @@
pkgs,
...
}: {
formatter = pkgs.alejandra;
devShells = {
default = self'.devShells.lsp;
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
@ -70,6 +69,21 @@
packages = with pkgs; [nil statix deadnix alejandra];
};
};
# Provide the default formatter. `nix fmt` in project root
# will format available files with the correct formatter.
# P.S: Please do not format with nixfmt! It messes with many
# syntax elements and results in unreadable code.
formatter = pkgs.alejandra;
# Check if codebase is properly formatted.
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
# or with `nix flake check`
checks = {
nix-fmt = pkgs.runCommand "nix-fmt-check" {nativeBuildInputs = [pkgs.alejandra];} ''
alejandra --check ${self} < /dev/null | tee $out
'';
};
};
};
@ -90,10 +104,7 @@
flake = false;
};
# TODO: get zig from the zig overlay instead of nixpkgs
zig.url = "github:mitchellh/zig-overlay";
# Langauge server (use master instead of nixpkgs)
# Language servers (use master instead of nixpkgs)
rnix-lsp.url = "github:nix-community/rnix-lsp";
nil = {
url = "github:oxalica/nil";
@ -159,7 +170,12 @@
flake = false;
};
# language support
plugin-otter-nvim = {
url = "github:jmbuhr/otter.nvim";
flake = false;
};
# Language support
plugin-sqls-nvim = {
url = "github:nanotee/sqls.nvim";
flake = false;

View file

@ -8,6 +8,7 @@
docs = import ../docs {inherit pkgs inputs lib;};
in {
packages = {
inherit (docs.manual) htmlOpenTool;
# Documentation
docs = docs.manual.html;
docs-html = docs.manual.html;

View file

@ -1,18 +0,0 @@
{
inputs,
lib,
}: let
modulesWithInputs = import ../modules inputs;
in
{
modules ? [],
pkgs,
check ? true,
extraSpecialArgs ? {},
extraModules ? [],
...
}:
modulesWithInputs {
inherit pkgs lib check extraSpecialArgs extraModules;
configuration.imports = modules;
}

View file

@ -11,5 +11,5 @@
languages = import ./languages.nix {inherit lib;};
lists = import ./lists.nix {inherit lib;};
lua = import ./lua.nix {inherit lib;};
neovimConfiguration = import ./configuration.nix {inherit inputs lib;};
neovimConfiguration = import ../modules {inherit inputs lib;};
}

View file

@ -97,7 +97,7 @@ in {
default = {};
type = submodule {
freeformType = attrsOf anything;
freeformType = anything;
options = opts;
};
};

View file

@ -1,10 +1,13 @@
inputs: {
configuration,
pkgs,
{
inputs,
lib,
check ? true,
}: {
pkgs,
extraSpecialArgs ? {},
modules ? [],
# deprecated
extraModules ? [],
configuration ? {},
}: let
inherit (pkgs) vimPlugins;
inherit (lib.strings) isString toString;
@ -13,13 +16,25 @@ inputs: {
# import modules.nix with `check`, `pkgs` and `lib` as arguments
# check can be disabled while calling this file is called
# to avoid checking in all modules
nvimModules = import ./modules.nix {inherit pkgs check lib;};
nvimModules = import ./modules.nix {inherit pkgs lib;};
# evaluate the extended library with the modules
# optionally with any additional modules passed by the user
module = lib.evalModules {
specialArgs = extraSpecialArgs // {modulesPath = toString ./.;};
modules = concatLists [[configuration] nvimModules extraModules];
modules = concatLists [
nvimModules
modules
(lib.optional (configuration != {}) (lib.warn ''
nvf: passing 'configuration' to lib.neovimConfiguration is deprecated.
''
configuration))
(lib.optionals (extraModules != []) (lib.warn ''
nvf: passing 'extraModules' to lib.neovimConfiguration is deprecated, use 'modules' instead.
''
extraModules))
];
};
# alias to the internal configuration

View file

@ -1,77 +1,72 @@
{
check ? true,
pkgs,
lib,
}: let
inherit (lib.modules) mkDefault;
inherit (lib.lists) concatLists;
allModules = let
# The core neovim modules.
# Contains configuration for core neovim features
# such as spellchecking, mappings, and the init script (init.vim).
neovim = map (p: ./neovim + "/${p}") [
"init"
"mappings"
];
# The core neovim modules.
# Contains configuration for core neovim features
# such as spellchecking, mappings, and the init script (init.vim).
neovim = map (p: ./neovim + "/${p}") [
"init"
"mappings"
];
# Individual plugin modules, separated by the type of plugin.
# While adding a new type, you must make sure your type is
# included in the list below.
plugins = map (p: ./plugins + "/${p}") [
"assistant"
"autopairs"
"comments"
"completion"
"dashboard"
"debugger"
"filetree"
"git"
"languages"
"lsp"
"minimap"
"notes"
"projects"
"rich-presence"
"session"
"snippets"
# "spellcheck" # FIXME: see neovim/init/spellcheck.nix
"statusline"
"tabline"
"terminal"
"theme"
"treesitter"
"ui"
"utility"
"visuals"
];
# Individual plugin modules, separated by the type of plugin.
# While adding a new type, you must make sure your type is
# included in the list below.
plugins = map (p: ./plugins + "/${p}") [
"assistant"
"autopairs"
"comments"
"completion"
"dashboard"
"debugger"
"filetree"
"git"
"languages"
"lsp"
"minimap"
"notes"
"projects"
"rich-presence"
"session"
"snippets"
# "spellcheck" # FIXME: see neovim/init/spellcheck.nix
"statusline"
"tabline"
"terminal"
"theme"
"treesitter"
"ui"
"utility"
"visuals"
];
# The neovim wrapper, used to build a wrapped neovim package
# using the configuration passed in `neovim` and `plugins` modules.
wrapper = map (p: ./wrapper + "/${p}") [
"build"
"rc"
"warnings"
];
# The neovim wrapper, used to build a wrapped neovim package
# using the configuration passed in `neovim` and `plugins` modules.
wrapper = map (p: ./wrapper + "/${p}") [
"build"
"rc"
"warnings"
];
# Extra modules, such as deprecation warnings
# or renames in one place.
extra = map (p: ./extra + "/${p}") [
"deprecations.nix"
];
allModules = concatLists [neovim plugins wrapper extra];
pkgsModule = {config, ...}: {
config = {
_module = {
inherit check;
args = {
baseModules = allModules;
pkgsPath = mkDefault pkgs.path;
pkgs = mkDefault pkgs;
};
};
};
};
# Extra modules, such as deprecation warnings
# or renames in one place.
extra = map (p: ./extra + "/${p}") [
"deprecations.nix"
];
in
concatLists [neovim plugins wrapper extra];
in
allModules ++ [pkgsModule]
allModules
++ [
{
_module.args = {
baseModules = allModules;
pkgsPath = mkDefault pkgs.path;
pkgs = mkDefault pkgs;
};
}
]

View file

@ -5,16 +5,17 @@
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.dashboard.dashboard-nvim;
in {
config = mkIf cfg.enable {
vim.startPlugins = [
"dashboard-nvim"
];
vim = {
startPlugins = ["dashboard-nvim"];
vim.pluginRC.dashboard-nvim = entryAnywhere ''
require("dashboard").setup{}
'';
pluginRC.dashboard-nvim = entryAnywhere ''
require("dashboard").setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -1,7 +1,9 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.dashboard.dashboard-nvim = {
enable = mkEnableOption "Fancy and Blazing Fast start screen plugin of neovim [dashboard.nvim]";
setupOpts = mkPluginSetupOption "dashboard.nvim" {};
};
}

View file

@ -20,6 +20,8 @@ in {
"neo-tree-nvim"
];
visuals.nvimWebDevicons.enable = true;
pluginRC.neo-tree = entryAnywhere ''
require("neo-tree").setup(${toLuaObject cfg.setupOpts})
'';

View file

@ -18,6 +18,7 @@ in {
./ocaml.nix
./php.nix
./python.nix
./r.nix
./rust.nix
./sql.nix
./svelte.nix

View file

@ -114,12 +114,12 @@ in {
(mkIf cfg.elixir-tools.enable {
vim.startPlugins = ["elixir-tools"];
vim.pluginRC.elixir-tools = entryAnywhere ''
local elixir-tools = require("elixir")
local elixirls = require("elixir-tools.elixirls")
local elixir = require("elixir")
local elixirls = require("elixir.elixirls")
-- disable imperative insstallations of various
-- elixir related tools installed by elixir-tools
elixir-tools.setup {
elixir.setup {
nextls = {
enable = false -- defaults to false
},

View file

@ -0,0 +1,78 @@
{
config,
pkgs,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption literalExpression;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either listOf package str;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.types) mkGrammarOption;
cfg = config.vim.languages.r;
r-with-languageserver = pkgs.rWrapper.override {
packages = with pkgs.rPackages; [languageserver];
};
defaultServer = "r_language_server";
servers = {
r_language_server = {
package = pkgs.writeShellScriptBin "r_lsp" ''
${r-with-languageserver}/bin/R --slave -e "languageserver::run()"
'';
lspConfig = ''
lspconfig.r_language_server.setup{
capabilities = capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${lib.getExe cfg.lsp.package}"}''
}
}
'';
};
};
in {
options.vim.languages.r = {
enable = mkEnableOption "R language support";
treesitter = {
enable = mkEnableOption "R treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "r";
};
lsp = {
enable = mkEnableOption "R LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
description = "R LSP server to use";
type = enum (attrNames servers);
default = defaultServer;
};
package = mkOption {
description = "R LSP server package, or the command to run as a list of strings";
example = literalExpression "[ (lib.getExe pkgs.jdt-language-server) \"-data\" \"~/.cache/jdtls/workspace\" ]";
type = either package (listOf str);
default = servers.${cfg.lsp.server}.package;
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.r-lsp = servers.${cfg.lsp.server}.lspConfig;
})
]);
}

View file

@ -17,12 +17,12 @@
cfg = config.vim.languages.ts;
defaultServer = "tsserver";
defaultServer = "ts_ls";
servers = {
tsserver = {
ts_ls = {
package = pkgs.typescript-language-server;
lspConfig = ''
lspconfig.tsserver.setup {
lspconfig.ts_ls.setup {
capabilities = capabilities;
on_attach = attach_keymaps,
cmd = ${
@ -49,6 +49,24 @@
}
'';
};
# Here for backwards compatibility. Still consider tsserver a valid
# configuration in the enum, but assert if it's set to *properly*
# redirect the user to the correct server.
tsserver = {
package = pkgs.typescript-language-server;
lspConfig = ''
lspconfig.ts_ls.setup {
capabilities = capabilities;
on_attach = attach_keymaps,
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/typescript-language-server", "--stdio"}''
}
}
'';
};
};
# TODO: specify packages
@ -65,6 +83,7 @@
)
'';
};
prettierd = {
package = pkgs.prettierd;
nullConfig = ''
@ -94,6 +113,7 @@
};
};
in {
_file = ./ts.nix;
options.vim.languages.ts = {
enable = mkEnableOption "Typescript/Javascript language support";
@ -190,11 +210,32 @@ in {
};
})
# Extensions
(mkIf cfg.extensions."ts-error-translator".enable {
vim.startPlugins = ["ts-error-translator"];
vim.pluginRC.ts-error-translator = entryAnywhere ''
require("ts-error-translator").setup(${toLuaObject cfg.extensions.ts-error-translator.setupOpts})
'';
})
# Warn the user if they have set the default server name to tsserver to match upstream (us)
# The name "tsserver" has been deprecated in lspconfig, and now should be called ts_ls. This
# is a purely cosmetic change, but emits a warning if not accounted for.
{
assertions = [
{
assertion = cfg.lsp.enable -> cfg.lsp.server != "tsserver";
message = ''
As of a recent lspconfig update, the `tsserver` configuration has been renamed
to `ts_ls` to match upstream behaviour of `lspconfig`, and the name `tsserver`
is no longer considered valid by nvf. Please set `vim.languages.ts.lsp.server`
to `"ts_ls"` instead of to `${cfg.lsp.server}`
Please see <https://github.com/neovim/nvim-lspconfig/pull/3232> for more details
about this change.
'';
}
];
}
]);
}

View file

@ -13,6 +13,7 @@
./trouble
./lsp-signature
./lightbulb
./otter
./lspkind
./lsplines
./nvim-docs-view

View file

@ -0,0 +1,39 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
cfg = config.vim.lsp;
self = import ./otter.nix {inherit lib;};
mappingDefinitions = self.options.vim.lsp.otter-nvim.mappings;
mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions;
in {
config = mkIf (cfg.enable && cfg.otter-nvim.enable) {
assertions = [
{
assertion = !config.vim.utility.ccc.enable;
message = ''
ccc and otter have a breaking conflict. It's been reported upstream. Until it's fixed, disable one of them
'';
}
];
vim = {
startPlugins = ["otter-nvim"];
maps.normal = mkMerge [
(mkSetBinding mappings.toggle "<cmd>lua require'otter'.activate()<CR>")
];
pluginRC.otter-nvim = entryAnywhere ''
-- Enable otter diagnostics viewer
require("otter").setup({${toLuaObject cfg.otter-nvim.setupOpts}})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./otter.nix
./config.nix
];
}

View file

@ -0,0 +1,64 @@
{lib, ...}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.types) bool str listOf;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.lsp = {
otter-nvim = {
enable = mkEnableOption ''
lsp features and a code completion source for code embedded in other documents [otter-nvim]
'';
mappings = {
toggle = mkMappingOption "Activate LSP on Cursor Position [otter-nvim]" "<leader>lo";
};
setupOpts = mkPluginSetupOption "otter.nvim" {
lsp = {
diagnostic_update_event = mkOption {
type = listOf str;
default = ["BufWritePost"];
description = ''
`:h events` that cause the diagnostic to update.
Set to: {"BufWritePost", "InsertLeave", "TextChanged" }
for less performant but more instant diagnostic updates
'';
};
};
buffers = {
set_filetype = mkOption {
type = bool;
default = false;
description = ''
if set to true, the filetype of the otterbuffers will be set. Other wide only
the autocommand of lspconfig that attaches the language server will be
executed without stting the filetype
'';
};
write_to_disk = mkOption {
type = bool;
default = false;
description = ''
write <path>.otter.<embedded language extension> files to disk on save of main buffer.
Useful for some linters that require actual files.
Otter files are deleted on quit or main buffer close
'';
};
};
strip_wrapping_quote_characters = mkOption {
type = listOf str;
default = ["'" ''"'' "`"];
description = ''
'';
};
handle_leading_whitespace = mkOption {
type = bool;
default = false;
description = ''
otter may not work the way you expect when entire code blocks are indented
(eg. in Org files) When true, otter handles these cases fully.
'';
};
};
};
};
}

View file

@ -17,29 +17,36 @@
"ayu_dark"
"ayu_light"
"ayu_mirage"
"ayu"
"codedark"
"dracula"
"everforest"
"gruvbox"
"gruvbox_dark"
"gruvbox_light"
"gruvbox_material"
"horizon"
"iceberg_dark"
"iceberg_light"
"iceberg"
"jellybeans"
"material"
"modus_vivendi"
"molokai"
"moonfly"
"nightfly"
"nord"
"oceanicnext"
"onedark"
"onelight"
"palenight"
"papercolor_dark"
"papercolor_light"
"powerline_dark"
"powerline"
"seoul256"
"solarized_dark"
"solarized_light"
"tomorrow"
"wombat"
];
@ -224,7 +231,7 @@ in {
local buf_ft = vim.api.nvim_get_option_value('filetype', {})
-- List of buffer types to exclude
local excluded_buf_ft = {"toggleterm", "NvimTree", "TelescopePrompt"}
local excluded_buf_ft = {"toggleterm", "NvimTree", "neo-tree", "TelescopePrompt"}
-- Check if the current buffer type is in the excluded list
for _, excluded_type in ipairs(excluded_buf_ft) do

View file

@ -69,7 +69,7 @@ in {
notify = true, -- nvim-notify
which_key = true,
navic = {
enabled = false,
enabled = true,
custom_bg = "NONE", -- "lualine" will set background to mantle
},
},

View file

@ -4,9 +4,8 @@
lib,
...
}: let
inherit (lib.strings) stringLength concatMapStringsSep;
inherit (lib.strings) concatMapStringsSep;
inherit (lib.modules) mkIf;
cfg = config.vim.utility.preview.markdownPreview;
in {
config = mkIf cfg.enable {
@ -19,8 +18,8 @@ in {
mkdp_filetypes = [(concatMapStringsSep ", " (x: "'" + x + "'") cfg.filetypes)];
mkdp_command_for_global = cfg.alwaysAllowPreview;
mkdp_open_to_the_world = cfg.broadcastServer;
mkdp_open_ip = mkIf (stringLength cfg.customIP > 0) cfg.customIP;
mkdp_port = mkIf (stringLength cfg.customPort > 0) cfg.customPort;
mkdp_open_ip = cfg.customIP;
mkdp_port = cfg.customPort;
};
};
}

View file

@ -80,10 +80,11 @@
maps);
in {
config = let
filterNonNull = attrs: filterAttrs (_: value: value != null) attrs;
globalsScript =
mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}")
(filterNonNull cfg.globals);
mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}") cfg.globals;
optionsScript =
mapAttrsToList (name: value: "vim.o.${name} = ${toLuaObject value}") cfg.options;
extraPluginConfigs = resolveDag {
name = "extra plugin configs";
@ -132,9 +133,12 @@ in {
in {
vim = {
luaConfigRC = {
# `vim.g` and `vim.o`
globalsScript = entryAnywhere (concatLines globalsScript);
# basic
pluginConfigs = entryAfter ["basic"] pluginConfigs;
optionsScript = entryAfter ["basic"] (concatLines optionsScript);
# Basic
pluginConfigs = entryAfter ["optionsScript"] pluginConfigs;
extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs;
mappings = entryAfter ["extraPluginConfigs"] mappings;
};

View file

@ -129,16 +129,38 @@ in {
globals = mkOption {
type = attrs;
default = {};
example = {"some_variable" = 42;};
description = ''
An attribute set containing global variable values
for storing vim variables as early as possible. If
populated, this option will set vim variables in the
built luaConfigRC as the first item.
E.g. {foo = "bar"} will set `vim.g.foo` to "bar" where
the type of `bar` in the resulting vimscript will be
infered from the type of the value in the `{name = value}`
pair.
::: {.note}
`{foo = "bar";}` will set `vim.g.foo` to "bar", where
the type of `bar` in the resulting Lua value will be
inferred from the type of the value in the `{name = value;}`
pair passed to the option.
:::
'';
};
options = mkOption {
type = attrs;
default = {};
example = {visualbell = true;};
description = ''
An attribute set containing vim options to be set
as early as possible. If populated, this option will
set vim options in the built luaConfigRC after `basic`
and before `pluginConfigs` DAG entries.
::: {.note}
`{foo = "bar";}` will set `vim.o.foo` to "bar", where
the type of `bar` in the resulting Lua value will be
inferred from the type of the value in the`{name = value;}`
pair passed to the option.
:::
'';
};