Skip to content

Commit

Permalink
dev: rebase on a less personalized neovim flake
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAShelf committed Feb 1, 2023
0 parents commit 9c00808
Show file tree
Hide file tree
Showing 70 changed files with 4,910 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
17 changes: 17 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Pull request"
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
jobs:
nix-flake-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- run: nix flake check
34 changes: 34 additions & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Github Pages docs
on:
push:
branches:
- main

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v18
- name: Build
run: |
nix build '.#docs-html'
cp -r result/share/doc/neovim-flake public
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
result
.config
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Jordan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# neovim-flake

A highly configurable nix flake for neovim.

Come join the Matrix room if you have any questions or need help: [#neovim-flake:matrix.org](https://matrix.to/#/#neovim-flake:matrix.org)

## Documentation

See the [neovim-flake Manual](https://jordanisaacs.github.io/neovim-flake/) for documentation, available options, and release notes.

If you want to dive right into trying neovim-flake you can get a fully featured configuration with `nix` language support by running:

```
nix run github:jordanisaacs/neovim-flake
```

## Screenshot

![screenshot](./screenshot.png)

## Philosophy

The philosophy behind this flake configuration is to allow for easily configurable and reproducible neovim environments. Enter a directory and have a ready to go neovim configuration that is the same on every machine. Whether you are a developer, writer, or live coder (see tidal cycles below!), quickly craft a config that suits every project's need. Think of it like a distribution of Neovim that takes advantage of pinning vim plugins and third party dependencies (such as tree-sitter grammars, language servers, and more).

As a result, one should never get a broken config when setting options. If setting multiple options results in a broken neovim, file an issue! Each plugin knows when another plugin which allows for smart configuration of keybindings and automatic setup of things like completion sources and languages.


## Credit

Originally based on Wil Taylor's amazing [neovim-flake](https://github.com/wiltaylor/neovim-flake)
42 changes: 42 additions & 0 deletions docs/custom-configs.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[[ch-custom-configuration]]
== Custom Configuration

Custom configuration is done with the `neovimConfiguration` function. It takes in the configuration as a module. The output of the configuration function is an attrset.

[source,nix]
----
{
options = "The options that were available to configure";
config = "The outputted configuration";
pkgs = "The package set used to evaluate the module";
neovim = "The built neovim package";
}
----

The following is an example of a barebones vim configuration with the default theme enabled.

[source,nix]
----
{
inputs.neovim-flake.url = "github:jordanisaacs/neovim-flake";
outputs = {nixpkgs, neovim-flake, ...}: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
configModule = {
# Add any custom options (and feel free to upstream them!)
# options = ...
config.vim.theme.enable = true;
};
customNeovim = neovim-flake.lib.neovimConfiguration {
modules = [configModule];
inherit pkgs;
};
in {
packages.${system}.neovim = customNeovim.neovim;
};
}
----

36 changes: 36 additions & 0 deletions docs/default-configs.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[[ch-default-configs]]
== Default Configs

While you can configure neovim-flake yourself using the builder, here are a few default configurations you can use.

[[sec-default-tidal]]
=== Tidal Cycles

[source,console]
$ nix run github:jordanisaacs/neovim-flake#tidal file.tidal

Utilizing https://github.com/tidalcycles/vim-tidal[vim-tidal] and mitchmindtree's fantastic https://github.com/mitchmindtree/tidalcycles.nix[tidalcycles.nix] start playing with tidal cycles in a single command.

In your tidal file, type a cycle e.g. `d1 $ s "drum"` and then press _ctrl+enter_. Super collider with superdirt, and a modified GHCI with tidal will start up and begin playing. Note, you need jack enabled on your system. If you are using pipewire, its as easy as setting `services.pipewire.jack.enable = true`.


[[sec-default-nix]]
=== Nix

[source,console]
$ nix run github:jordanisaacs/neovim-flake#nix test.nix

Enables all the of neovim plugins, with language support for specifically Nix. This lets you see what a fully configured neovim setup looks like without downloading a whole bunch of language servers and associated tools.

[[sec-default-maximal]]
=== Maximal

[source,console]
$ nix shell github:jordanisaacs/neovim-flake#maximal test.nix

It is the same fully configured neovim as with the <<sec-default-nix,Nix>> config, but with every supported language enabled.

[NOTE]
====
Running the maximal config will download *a lot* of packages as it is downloading language servers, formatters, and more.
====
54 changes: 54 additions & 0 deletions docs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
pkgs,
lib ? import ../modules/lib/stdlib-extended.nix pkgs.lib,
nmdSrc,
}: let
nmd = import nmdSrc {inherit lib pkgs;};
scrubbedPkgsModule = {
imports = [
{
_module.args = {
pkgs = lib.mkForce (nmd.scrubDerivations "pkgs" pkgs);
};
}
];
};

nvimModuleDocs = nmd.buildModulesDocs {
modules =
import ../modules/modules.nix {
inherit pkgs lib;
check = false;
}
++ [scrubbedPkgsModule];
moduleRootPaths = [./..];
mkModuleUrl = path: "https://github.com/jordanisaacs/neovim-flake/blob/main/${path}#blob-path";
channelName = "neovim-flake";
docBook.id = "neovim-flake-options";
};

docs = nmd.buildDocBookDocs {
pathName = "neovim-flake";
projectName = "neovim-flake";
modulesDocs = [nvimModuleDocs];
documentsDirectory = ./.;
documentType = "book";
chunkToc = ''
<toc>
<d:tocentry xmlns:d="http://docbook.org/ns/docbook" linkend="book-neovim-flake-manual">
<?dbhtml filename="index.html"?>
<d:tocentry linkend="ch-options">
<?dbhtml filename="options.html"?>
</d:tocentry>
<d:tocentry linkend="ch-release-notes">
<?dbhtml filename="release-notes.html"?>
</d:tocentry>
</d:tocentry>
</toc>
'';
};
in {
options.json = nvimModuleDocs.json.override {path = "share/doc/neovim-flake/options.json";};
manPages = docs.manPages;
manual = {inherit (docs) html htmlOpenTool;};
}
71 changes: 71 additions & 0 deletions docs/languages.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[[ch-languages]]
== Language Support

Language specific support combines some combination of language specific plugins, `treesitter` support, `nvim-lspconfig` langauge servers, and `null-ls` integration. This gets you capabilities ranging from autocompletion to formatting to diagnostics. The following languages have support beyond just `treesitter` highlighting.

[[sec-languages-rust]]
=== Rust

*LSP Server*: https://github.com/rust-analyzer/rust-analyzer[rust-analyzer]

*Formatting*: Built into LSP, uses https://github.com/rust-lang/rustfmt[rustfmt]

*Plugins*: See <<sec-plugins-rust,here>>

[[sec-languages-nix]]
=== Nix

*LSP Server*: Choice between https://github.com/oxalica/nil[nil] and https://github.com/nix-community/rnix-lsp[rnix-lsp]

*Formatting*: Choice between https://github.com/kamadorueda/alejandra[alejandra] and https://github.com/nix-community/nixpkgs-fmt[nixpkgs-fmt]

[[sec-languages-sql]]
=== SQL

*LSP Server*: https://github.com/lighttiger2505/sqls[sqls]

*Formatting*: Disabled LSP formatting, instead using https://github.com/sqlfluff/sqlfluff[sqlfluff]

*Linting*: https://github.com/sqlfluff/sqlfluff[sqlfluff]

*Plugins*: See <<sec-plugins-sql,here>>

[[sec-languages-clang]]
=== C/C++

*LSP Server*: https://github.com/MaskRay/ccls[ccls]

*Formatting*: Built into language server

[[sec-languages-typescript]]
=== Typescript

*LSP Server*: https://github.com/typescript-language-server/typescript-language-server[typescript-language-server]

*Formatting*: Disabled LSP formatting, instead using https://github.com/prettier/prettier[prettier]

*Linting*: https://github.com/prettier/prettier[eslint]

[[sec-languages-python]]
=== Python

*LSP Server*: https://github.com/microsoft/pyright[pyright]

*Formatting*: https://github.com/psf/black[black]

[[sec-languages-zig]]
=== Zig

*LSP Server*: https://github.com/zigtools/zls[zls]

*Formatting*: Built into LSP, uses `zig fmt`.

[[sec-languages-markdown]]
=== Markdown

*Plugins*: See <<sec-plugins-markdown,here>>

[[sec-languages-html]]
=== HTML

*Plugins*: See <<sec-plugins-html,here>>
42 changes: 42 additions & 0 deletions docs/man-configuration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<refentry xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude">
<refmeta>
<refentrytitle>neovim-flake configuration</refentrytitle>
<manvolnum>5</manvolnum>
<refmiscinfo class="source">neovim-flake</refmiscinfo>
<!-- <refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo> -->
</refmeta>
<refnamediv>
<refname>neovim configuration</refname>
<refpurpose>neovim-flake configuration specification</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para>
Custom configuration is done with the neovim-flake.lib.neovimConfiguration function. It takes in the configuration as a module.
<programlisting>
neovim-flake.lib.neovimConfiguration {
inherit pkgs;
modules = [{config = xxx;}];
};
</programlisting>
The output of the configuration function is an attrset.
</para>
<programlisting>
{
options = "The options that were available to configure";
config = "The outputted configuration";
pkgs = "The package set used to evaluate the module";
neovim = "The built neovim package";
}
</programlisting>
</refsection>
<refsection>
<title>Options</title>
<para>
You can use the following options in your neovim configuration.
</para>
<xi:include href="./nmd-result/neovim-flake-options.xml"/>
</refsection>
</refentry>
13 changes: 13 additions & 0 deletions docs/man-pages.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<reference xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude">
<title>neovim-flake Reference Pages</title>
<info>
<author><personname>neovim-flake contributors</personname></author>
<copyright>
<year>2021–2022</year>
<holder>neovim-flake contributors</holder>
</copyright>
</info>
<xi:include href="man-configuration.xml" />
</reference>
Loading

0 comments on commit 9c00808

Please sign in to comment.