Merge branch 'main' into improve-terraformls

This commit is contained in:
ppenguin 2026-02-28 14:45:09 +01:00 committed by GitHub
commit b05b9b1ee0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
67 changed files with 1455 additions and 275 deletions

View file

@ -13,7 +13,6 @@ trim_trailing_whitespace = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = false
max_line_length = 80
[*.{js,json,nix,yml,yaml,toml}]
indent_style = space

3
.github/typos.toml vendored
View file

@ -9,6 +9,7 @@ default.extend-ignore-words-re = [
"edn",
"esy",
"BA", # somehow "BANanaD3V" is valid, but BA is not...
"Emac"
"Emac",
"tese" # for glsl shaders
]

View file

@ -25,7 +25,7 @@ jobs:
name: Checkout
- name: Install Nix
uses: cachix/install-nix-action@v31.9.0
uses: cachix/install-nix-action@v31.9.1
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |

View file

@ -18,7 +18,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31.9.0
- uses: cachix/install-nix-action@v31.9.1
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
@ -37,7 +37,7 @@ jobs:
uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v31.9.0
uses: cachix/install-nix-action@v31.9.1
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
@ -93,13 +93,20 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31.9.0
- uses: cachix/install-nix-action@v31.9.1
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
substituters = https://cache.nixos.org/ https://feel-co.cachix.org
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= feel-co.cachix.org-1:nwEFNnwZvtl4KKSH5LDg+/+K7bV0vcs6faMHAJ6xx0w=
- uses: cachix/cachix-action@v16
with:
authToken: ${{ secrets.CACHIX_TOKEN }}
extraPullNames: nix-community
name: nvf
pushFilter: '(ndg-\d+\.\d+\.\d+$)'
- name: Set default git branch (to reduce log spam)
run: git config --global init.defaultBranch main
@ -112,7 +119,7 @@ jobs:
run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> ${GITHUB_OUTPUT}
- name: Upload doc artifacts
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@v7
with:
name: "${{ matrix.package }}"
path: result/share/doc/nvf
@ -124,7 +131,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31.9.0
- uses: cachix/install-nix-action@v31.9.1
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
@ -162,7 +169,7 @@ jobs:
cat "$HOME/changed_files"
- name: Install Nix
uses: cachix/install-nix-action@v31.9.0
uses: cachix/install-nix-action@v31.9.1
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |

View file

@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31.9.0
- uses: cachix/install-nix-action@v31.9.1
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |

View file

@ -44,7 +44,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31.9.0
- uses: cachix/install-nix-action@v31.9.1
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |

View file

@ -12,7 +12,7 @@ jobs:
uses: actions/checkout@v6
- name: "Install Nix"
uses: cachix/install-nix-action@v31.9.0
uses: cachix/install-nix-action@v31.9.1
- name: Set up Git
run: |

View file

@ -55,6 +55,7 @@ isMaximal: {
# Languages that are enabled in the maximal configuration.
bash.enable = isMaximal;
clang.enable = isMaximal;
cmake.enable = isMaximal;
css.enable = isMaximal;
html.enable = isMaximal;
json.enable = isMaximal;
@ -72,8 +73,10 @@ isMaximal: {
extensions.crates-nvim.enable = isMaximal;
};
toml.enable = isMaximal;
xml.enable = isMaximal;
# Language modules that are not as common.
arduino.enable = false;
assembly.enable = false;
astro.enable = false;
nu.enable = false;
@ -83,6 +86,7 @@ isMaximal: {
scala.enable = false;
r.enable = false;
gleam.enable = false;
glsl.enable = false;
dart.enable = false;
ocaml.enable = false;
elixir.enable = false;
@ -91,10 +95,12 @@ isMaximal: {
ruby.enable = false;
fsharp.enable = false;
just.enable = false;
make.enable = false;
qml.enable = false;
jinja.enable = false;
tailwind.enable = false;
svelte.enable = false;
tera.enable = false;
# Nim LSP is broken on Darwin and therefore
# should be disabled by default. Users may still enable
@ -112,6 +118,7 @@ isMaximal: {
fidget-nvim.enable = true;
highlight-undo.enable = true;
blink-indent.enable = true;
indent-blankline.enable = true;
# Fun
@ -202,6 +209,7 @@ isMaximal: {
smart-splits.enable = isMaximal;
undotree.enable = isMaximal;
nvim-biscuits.enable = isMaximal;
grug-far-nvim.enable = isMaximal;
motion = {
hop.enable = true;

View file

@ -17,6 +17,7 @@ configuring/custom-package.md
configuring/custom-plugins.md
configuring/overriding-plugins.md
configuring/languages.md
configuring/keybinds.md
configuring/dags.md
configuring/dag-entries.md
configuring/autocmds.md

View file

@ -0,0 +1,38 @@
# Custom keymaps {#ch-keymaps}
Some plugin modules provide keymap options for your convenience. If a keymap is
not provided by such module options, you may easily register your own custom
keymaps via {option}`vim.keymaps`.
```nix
{
config.vim.keymaps = [
{
key = "<leader>m";
mode = "n";
silent = true;
action = ":make<CR>";
}
{
key = "<leader>l";
mode = ["n" "x"];
silent = true;
action = "<cmd>cnext<CR>";
}
{
key = "<leader>k";
mode = ["n" "x"];
# While `lua` is `true`, `action` is expected to be
# a valid Lua expression.
lua = true;
action = ''
function()
require('foo').do_thing()
print('did thing')
end
'';
}
];
}
```

View file

@ -21,3 +21,43 @@ vim.languages.java = {
};
}
```
## Custom LSP Servers {#ch-custom-lsp-servers}
Neovim 0.11, in an effort to improve the out-of-the-box experience of Neovim,
has introduced a new `vim.lsp` API that can be used to register custom LSP
servers with ease. In **nvf**, this translates to the custom `vim.lsp` API that
can be used to register servers that are not present in existing language
modules.
The {option}`vim.lsp.servers` submodule can be used to modify existing LSP
definitions OR register your own custom LSPs respectively. For example, if you'd
like to avoid having NVF pull the LSP packages you may modify the start command
to use a string, which will cause the LSP API to discover LSP servers from
{env}`PATH`. For example:
```nix
{lib, ...}: {
vim.lsp.servers = {
# Get `basedpyright-langserver` from PATH, e.g., a dev shell.
basedpyright.cmd = lib.mkForce ["basedpyright-langserver" "--stdio"];
# Define a custom LSP entry using `vim.lsp.servers`:
ty = {
cmd = lib.mkDefault [(lib.getExe pkgs.ty) "server"];
filetypes = ["python"];
root_markers = [
".git"
"pyproject.toml"
"setup.cfg"
"requirements.txt"
"Pipfile"
"pyrightconfig.json"
];
# If your LSP accepts custom settings. See `:help lsp-config` for more details
# on available fields. This is a freeform field.
settings.ty = { /* ... */ };
};
}
```

View file

@ -14,11 +14,12 @@ vim.pluginOverrides = {
rev = "";
hash = "";
};
# It's also possible to use a flake input
lazydev-nvim = inputs.lazydev-nvim;
# Or a local path
lazydev-nvim = ./lazydev;
# Or a npins pin... etc
# Or a npins pin nvfetcher source, etc.
};
```

View file

@ -28,6 +28,29 @@ Some other settings and commands are now deprecated but are still supported.
- The `setupOpts.mappings` options were also removed. Use the built-in Neovim
settings (nvf's {option}`vim.keymaps`)
[Snoweuph](https://github.com/snoweuph)
- "Correct `languages.go.treesitter` to contain all Go file types.
`languages.go.treesitter.package` is now `languages.go.treesitter.goPackage`.
New are:
- `languages.go.treesitter.goPackage`.
- `languages.go.treesitter.gomodPackage`.
- `languages.go.treesitter.gosumPackage`.
- `languages.go.treesitter.goworkPackage`.
- `languages.go.treesitter.gotmplPackage`.
- Fix `vim.assistant.codecompanion-nvim.setupOpts.display.diff.provider` to only
allow valid options. `default` is no longer valid. `inline` and `split` are
two new valid options.
- Added [taplo](https://taplo.tamasfe.dev/) as the default formatter and lsp for
`languages.toml` so we don't default to AI-Slop.
## Changelog {#sec-release-0-9-changelog}
[taylrfnt](https://github.com/taylrfnt)
@ -53,6 +76,10 @@ Some other settings and commands are now deprecated but are still supported.
treesitter grammars were changed to prefer `grammarPlugins` over
`builtGrammars`.
[NotAShelf](https://github.com/notashelf):
- Lazyload noice.nvim and nvim-web-devicons on `DeferredUIEnter`
[jfeo](https://github.com/jfeo):
[ccc.nvim]: https://github.com/uga-rosa/ccc.nvim
@ -143,6 +170,9 @@ Some other settings and commands are now deprecated but are still supported.
- Added [sqruff](https://github.com/quarylabs/sqruff) support to `languages.sql`
- Lazy-load `crates.nvim` plugin when using
`vim.languages.rust.extensions.crates-nvim.enable`
- Added [Pyrefly](https://pyrefly.org/) and [zuban](https://zubanls.com/)
support to `languages.python`
@ -150,9 +180,14 @@ Some other settings and commands are now deprecated but are still supported.
[Tombi](https://tombi-toml.github.io/tombi/) language server, linter, and
formatter.
- Added Jinja support via `languages.jinja`
- Added [hlargs.nvim](https://github.com/m-demare/hlargs.nvim) support as
`visuals.hlargs-nvim`.
- Lazy-load `nvim-autopairs` plugin when using
`vim.autopairs.nvim-autopairs.enable`
[Machshev](https://github.com/machshev):
- Added `ruff` and `ty` LSP support for Python under `programs.python`.
@ -161,3 +196,90 @@ Some other settings and commands are now deprecated but are still supported.
- Added [Selenen](https://github.com/kampfkarren/selene) for more diagnostics in
`languages.lua`.
- Added [`mdformat`](https://mdformat.rtfd.io/) support to `languages.markdown`
with the extensions for [GFM](https://github.github.com/gfm/),
[front matter](https://www.markdownlang.com/advanced/frontmatter.html) and
[footnotes](https://www.markdownguide.org/extended-syntax/#footnotes).
- Added XML syntax highlighting, LSP support and formatting
- Added [mypy](https://www.mypy-lang.org/) to `languages.python` for extra
diagnostics.
- Added [tera](https://keats.github.io/tera/) language support (syntax
highlighting only).
- Added Debugging support to `languages.odin` with
[nvim-dap-odin](https://github.com/NANDquark/nvim-dap-odin).
- Disabled notifications for
[nvim-dap-odin](https://github.com/NANDquark/nvim-dap-odin), because it
contain no use full information, only spam, and it can't be made lazy.
- Added [`golangci-lint`](https://golangci-lint.run/) for more diagnostics.
- updated default filetypes for
[harper-ls](https://github.com/Automattic/harper) to match what they are
supposed to be.
- Added Makefile support via `languages.make`.
- Fix `languages.hcl` init, depending on `comment-nvim` by checking if it is
enabled. Fixes a crash (#1350).
- Added Debugging support to `languages.php`.
- Added Formatting support to `languages.php` via
[PHP-CS-Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer).
- Didn't Add
[`syntax-gaslighting`](https://github.com/NotAShelf/syntax-gaslighting.nvim),
you're crazy.
[vagahbond](https://github.com/vagahbond): [codewindow.nvim]:
https://github.com/gorbit99/codewindow.nvim
- Add [codewindow.nvim] plugin in `vim.assistant.codewindow` with `enable` and
`setupOpts`
[irobot](https://github.com/irobot):
- Fix non-functional `vim.keymaps.*.noremap`. Now, setting it to false is
equivalent to `:lua vim.keymap.set(..., { remap = true })`
[kazimazi](https://github.com/kazimazi):
- Added [`grug-far.nvim`](https://github.com/MagicDuck/grug-far.nvim) the find
and replace tool for neovim.
- Fix lsp `client.supports_method` deprecation warning in nvim v0.12.
- Add [`blink.indent`](https://github.com/saghen/blink.indent) indent guideline
plugin.
[Ladas552](https://github.com/Ladas552)
- Changed `withRuby` to not be enabled by default
- Fix virtualtext mode in colorizer
[horriblename](https://github.com/horriblename):
- Ignore terminals by default in spell-checking
[poz](https://poz.pet):
[neocmakelsp]: https://github.com/neocmakelsp/neocmakelsp
[arduino-language-server]: https://github.com/arduino/arduino-language-server
[glsl_analyzer]: https://github.com/nolanderc/glsl_analyzer
- Add CMake support with [neocmakelsp].
- Add Arduino support with [arduino-language-server].
- Add GLSL support with [glsl_analyzer].
[itscrystalline](https://github.com/itscrystalline):
[img-clip.nvim]: https://github.com/hakonharnes/img-clip.nvim
- [img-clip.nvim]'s configuration now has it's own DAG entry, separate from
image-nvim.
<!-- vim: set textwidth=80: -->

20
flake.lock generated
View file

@ -23,11 +23,11 @@
]
},
"locked": {
"lastModified": 1768135262,
"narHash": "sha256-PVvu7OqHBGWN16zSi6tEmPwwHQ4rLPU9Plvs8/1TUBY=",
"lastModified": 1769996383,
"narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "80daad04eddbbf5a4d883996a73f3f542fa437ac",
"rev": "57928607ea566b5db3ad13af0e57e921e6b12381",
"type": "github"
},
"original": {
@ -38,11 +38,11 @@
},
"mnw": {
"locked": {
"lastModified": 1768701608,
"narHash": "sha256-kSvWF3Xt2HW9hmV5V7i8PqeWJIBUKmuKoHhOgj3Znzs=",
"lastModified": 1770419553,
"narHash": "sha256-b1XqsH7AtVf2dXmq2iyRr2NC1yG7skY7Z6N2MpWHlK4=",
"owner": "Gerg-L",
"repo": "mnw",
"rev": "20d63a8a1ae400557c770052a46a9840e768926b",
"rev": "2aaffa8030d0b262176146adbb6b0e6374ce2957",
"type": "github"
},
"original": {
@ -74,16 +74,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1768875095,
"narHash": "sha256-dYP3DjiL7oIiiq3H65tGIXXIT1Waiadmv93JS0sS+8A=",
"lastModified": 1771008912,
"narHash": "sha256-gf2AmWVTs8lEq7z/3ZAsgnZDhWIckkb+ZnAo5RzSxJg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ed142ab1b3a092c4d149245d0c4126a5d7ea00b0",
"rev": "a82ccc39b39b621151d6732718e3e250109076fa",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}

View file

@ -122,7 +122,7 @@
systems.url = "github:nix-systems/default";
## Basic Inputs
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";

View file

@ -3,17 +3,17 @@
stdenv,
rustPlatform,
fetchFromGitHub,
writeShellScriptBin,
rust-jemalloc-sys,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "blink-cmp";
version = "1.8.0";
version = "1.9.1";
src = fetchFromGitHub {
owner = "Saghen";
repo = "blink.cmp";
tag = "v${finalAttrs.version}";
hash = "sha256-JjlcPj7v9J+v1SDBYIub6jFEslLhZGHmsipV1atUAFo=";
hash = "sha256-GgodXdWpQoF2z1g1/WvnSpfuhskw0aMcOoyZM5l66q8=";
};
forceShare = [
@ -21,6 +21,11 @@ rustPlatform.buildRustPackage (finalAttrs: {
"info"
];
# Tries to call git
preBuild = ''
rm build.rs
'';
postInstall = ''
cp -r {lua,plugin} "$out"
@ -31,12 +36,18 @@ rustPlatform.buildRustPackage (finalAttrs: {
mv "$out/lib" "$out/target/release"
'';
cargoHash = "sha256-Qdt8O7IGj2HySb1jxsv3m33ZxJg96Ckw26oTEEyQjfs=";
# From the blink.cmp flake
buildInputs = lib.optionals stdenv.hostPlatform.isAarch64 [rust-jemalloc-sys];
nativeBuildInputs = [
(writeShellScriptBin "git" "exit 1")
# NOTE: The only change in frizbee 0.7.0 was nixpkgs incompatible rust semantic changes
# Patch just reverts https://github.com/saghen/blink.cmp/commit/cc824ec85b789a54d05241389993c6ab8c040810
# Taken from Nixpkgs' blink.cmp derivation, available under the MIT license
cargoPatches = [
./patches/0001-pin-frizbee.patch
];
cargoHash = "sha256-Qdt8O7IGj2HySb1jxsv3m33ZxJg96Ckw26oTEEyQjfs=";
env = {
RUSTC_BOOTSTRAP = true;

View file

@ -0,0 +1,29 @@
diff --git a/Cargo.lock b/Cargo.lock
index 35bb10e..71c79eb 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -144,9 +144,9 @@ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
name = "frizbee"
-version = "0.7.0"
+version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d024031f1a5bc5f19917baa0b618f1067610e35ba23e9f105653fcb27e74f5c"
+checksum = "c3365720de81dac18e889afa72f5907aa061c975548da68e2400c056ebc94aec"
dependencies = [
"multiversion",
"rayon",
diff --git a/Cargo.toml b/Cargo.toml
index 392d1bb..c776c7d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,7 +9,7 @@ crate-type = ["cdylib"]
[dependencies]
regex = "1.11.2"
-frizbee = "0.7.0"
+frizbee = "0.6.0"
mlua = { version = "0.11.3", features = ["module", "luajit"] }
thiserror = "2.0.16"
blake3 = "1.8.2"

View file

@ -3,6 +3,8 @@
fetchFromGitHub,
nodejs,
pnpm_9,
pnpmConfigHook,
fetchPnpmDeps,
pins,
}: let
pin = pins.prettier-plugin-astro;
@ -17,7 +19,8 @@ in
sha256 = pin.hash;
};
pnpmDeps = pnpm_9.fetchDeps {
pnpmDeps = fetchPnpmDeps {
pnpm = pnpm_9;
inherit (finalAttrs) pname src;
fetcherVersion = 2;
hash = "sha256-K7pIWLkIIbUKDIcysfEtcf/eVMX9ZgyFHdqcuycHCNE=";
@ -25,7 +28,9 @@ in
nativeBuildInputs = [
nodejs
pnpm_9.configHook
(pnpmConfigHook.overrideAttrs {
propagatedBuildInputs = [pnpm_9];
})
];
buildPhase = ''

View file

@ -49,4 +49,4 @@ in
"expToLua"
"listToLuaTable"
"attrsetToLuaTable"
] (name: lib.warn "${name} is deprecated use toLuaObject instead" toLuaObject)
] (name: builtins.throw "${name} is deprecated use toLuaObject instead")

View file

@ -4,13 +4,14 @@
lib,
...
}: let
inherit (builtins) length;
inherit (lib.modules) mkIf mkRenamedOptionModule;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.strings) concatLines concatStringsSep optionalString;
inherit (lib.strings) concatLines concatStringsSep;
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.types) listOf str attrsOf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAfter;
inherit (lib.types) listOf str attrsOf bool;
inherit (lib.lists) optional;
inherit (lib.generators) mkLuaInline;
cfg = config.vim.spellcheck;
in {
@ -86,6 +87,12 @@ in {
'';
};
ignoreTerminal = mkOption {
type = bool;
default = true;
description = "Disable spell checking in terminal.";
};
programmingWordlist.enable = mkEnableOption ''
vim-dirtytalk, a wordlist for programmers containing
common programming terms.
@ -144,20 +151,25 @@ in {
spelllang = concatStringsSep "," cfg.languages;
};
# Register an autocommand to disable spellchecking in buffers with given filetypes.
# If the list is empty, the autocommand does not need to be registered.
luaConfigRC.spellcheck = entryAfter ["basic"] (optionalString (cfg.ignoredFiletypes != []) ''
-- Disable spellchecking for certain filetypes
-- as configured by `vim.spellcheck.ignoredFiletypes`
vim.api.nvim_create_augroup("nvf_autocmds", {clear = false})
vim.api.nvim_create_autocmd({ "FileType" }, {
group = "nvf_autocmds",
pattern = ${toLuaObject cfg.ignoredFiletypes},
callback = function()
vim.opt_local.spell = false
end,
augroups = [{name = "nvf_spellcheck";}];
autocmds =
(optional cfg.ignoreTerminal {
event = ["TermOpen"];
group = "nvf_spellcheck";
callback = mkLuaInline ''
function() vim.opt_local.spell = false end
'';
})
'');
++ (optional (length cfg.ignoredFiletypes > 0) {
event = ["FileType"];
group = "nvf_spellcheck";
pattern = cfg.ignoredFiletypes;
callback = mkLuaInline ''
function()
vim.opt_local.spell = false
end
'';
});
};
};
}

View file

@ -59,8 +59,8 @@ in {
};
provider = mkOption {
type = enum ["default" "mini_diff"];
default = "default";
type = enum ["inline" "split" "mini_diff"];
default = "inline";
description = "The preferred kind of provider.";
};
};

View file

@ -4,17 +4,14 @@
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.autopairs.nvim-autopairs;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["nvim-autopairs"];
pluginRC.autopairs = entryAnywhere ''
require('nvim-autopairs').setup(${toLuaObject cfg.setupOpts})
'';
vim.lazy.plugins.nvim-autopairs = {
package = "nvim-autopairs";
setupModule = "nvim-autopairs";
setupOpts = cfg.setupOpts;
event = ["InsertEnter"];
};
};
}

View file

@ -11,21 +11,21 @@
layoutDefined = cfg.layout != [];
in {
config = mkIf cfg.enable {
vim.startPlugins = [
"alpha-nvim"
"nvim-web-devicons"
];
vim = {
startPlugins = ["alpha-nvim"];
visuals.nvim-web-devicons.enable = true;
vim.pluginRC.alpha = let
setupOpts =
if themeDefined
then lib.generators.mkLuaInline "require'alpha.themes.${cfg.theme}'.config"
else {
inherit (cfg) layout opts;
};
in ''
require('alpha').setup(${toLuaObject setupOpts})
'';
pluginRC.alpha = let
setupOpts =
if themeDefined
then lib.generators.mkLuaInline "require'alpha.themes.${cfg.theme}'.config"
else {
inherit (cfg) layout opts;
};
in ''
require('alpha').setup(${toLuaObject setupOpts})
'';
};
assertions = [
{

View file

@ -9,11 +9,8 @@
in {
config = mkIf cfg.enable {
vim = {
startPlugins = [
# dependencies
"nui-nvim" # ui library
"nvim-web-devicons" # glyphs
];
startPlugins = ["nui-nvim"];
visuals.nvim-web-devicons.enable = true;
lazy.plugins = {
"hunk-nvim" = {

View file

@ -0,0 +1,95 @@
{
config,
pkgs,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.generators) mkLuaInline;
inherit (lib.meta) getExe getExe';
inherit (lib.modules) mkIf mkMerge;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) enum listOf str;
inherit (lib.nvim.attrsets) mapListToAttrs;
inherit (lib.nvim.types) mkGrammarOption;
cfg = config.vim.languages.arduino;
defaultServers = ["arduino-language-server"];
servers = {
arduino-language-server = {
enable = true;
cmd =
[
(getExe pkgs.arduino-language-server)
"-clangd"
(getExe' pkgs.clang-tools "clangd")
"-cli"
(getExe pkgs.arduino-cli)
"-cli-config"
"$HOME/.arduino15/arduino-cli.yaml"
]
++ cfg.lsp.extraArgs;
filetypes = ["arduino"];
root_dir =
mkLuaInline
/*
lua
*/
''
function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(util.root_pattern("*.ino")(fname))
end
'';
capabilities = {
textDocument = {
semanticTokens = mkLuaInline "vim.NIL";
};
workspace = {
semanticTokens = mkLuaInline "vim.NIL";
};
};
};
};
in {
options.vim.languages.arduino = {
enable = mkEnableOption "Arduino support";
treesitter = {
enable = mkEnableOption "Arduino treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "arduino";
};
lsp = {
enable = mkEnableOption "Arduino LSP support" // {default = config.vim.lsp.enable;};
servers = mkOption {
type = listOf (enum (attrNames servers));
default = defaultServers;
description = "Arduino LSP servers to use";
};
extraArgs = mkOption {
type = listOf str;
default = [];
description = "Extra arguments passed to the Arduino LSP";
};
};
};
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.servers =
mapListToAttrs (n: {
name = n;
value = servers.${n};
})
cfg.lsp.servers;
})
]);
}

View file

@ -97,7 +97,7 @@
local function symbol_info()
local bufnr = vim.api.nvim_get_current_buf()
local clangd_client = vim.lsp.get_clients({ bufnr = bufnr, name = "clangd" })[1]
if not clangd_client or not clangd_client.supports_method 'textDocument/symbolInfo' then
if not clangd_client or not clangd_client:supports_method 'textDocument/symbolInfo' then
return vim.notify('Clangd client not found', vim.log.levels.ERROR)
end
local win = vim.api.nvim_get_current_win()

View file

@ -0,0 +1,96 @@
{
config,
pkgs,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.meta) getExe;
inherit (lib.types) enum listOf package;
inherit (lib.nvim.attrsets) mapListToAttrs;
inherit (lib.nvim.types) mkGrammarOption;
cfg = config.vim.languages.cmake;
defaultServers = ["neocmakelsp"];
servers = {
neocmakelsp = {
enable = true;
cmd = [(getExe pkgs.neocmakelsp) "--stdio"];
filetypes = ["cmake"];
root_markers = [".gersemirc" ".git" "build" "cmake"];
capabilities = {
textDocument.completion.completionItem.snippetSupport = true;
};
};
};
defaultFormat = "gersemi";
formats = {
gersemi = {
package = pkgs.gersemi;
};
};
in {
options.vim.languages.cmake = {
enable = mkEnableOption "CMake language support";
treesitter = {
enable = mkEnableOption "CMake treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "cmake";
};
lsp = {
enable = mkEnableOption "CMake LSP support" // {default = config.vim.lsp.enable;};
servers = mkOption {
type = listOf (enum (attrNames servers));
default = defaultServers;
description = "CMake LSP servers to use";
};
};
format = {
enable = mkEnableOption "CMake formatting" // {default = config.vim.languages.enableFormat;};
type = mkOption {
description = "CMake formatter to use";
type = enum (attrNames formats);
default = defaultFormat;
};
package = mkOption {
description = "CMake formatter package";
type = package;
default = formats.${cfg.format.type}.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.servers =
mapListToAttrs (n: {
name = n;
value = servers.${n};
})
cfg.lsp.servers;
})
(mkIf cfg.format.enable {
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.cmake = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
]);
}

View file

@ -3,6 +3,7 @@
inherit (lib.nvim.languages) mkEnable;
in {
imports = [
./arduino.nix
./asm.nix
./astro.nix
./bash.nix
@ -10,17 +11,21 @@ in {
./dart.nix
./clang.nix
./clojure.nix
./cmake.nix
./css.nix
./elixir.nix
./fsharp.nix
./gleam.nix
./glsl.nix
./go.nix
./hcl.nix
./helm.nix
./kotlin.nix
./html.nix
./tera.nix
./haskell.nix
./java.nix
./jinja.nix
./json.nix
./lua.nix
./markdown.nix
@ -50,6 +55,8 @@ in {
./yaml.nix
./ruby.nix
./just.nix
./make.nix
./xml.nix
# This is now a hard deprecation.
(mkRenamedOptionModule ["vim" "languages" "enableLSP"] ["vim" "lsp" "enable"])

View file

@ -0,0 +1,63 @@
{
config,
lib,
pkgs,
...
}: let
inherit (builtins) attrNames;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) enum listOf;
inherit (lib.meta) getExe;
inherit (lib.nvim.attrsets) mapListToAttrs;
cfg = config.vim.languages.glsl;
defaultServers = ["glsl_analyzer"];
servers = {
glsl_analyzer = {
enable = true;
cmd = [(getExe pkgs.glsl_analyzer)];
filetypes = ["glsl" "vert" "tesc" "tese" "frag" "geom" "comp"];
root_markers = [".git"];
};
};
in {
options.vim.languages.glsl = {
enable = mkEnableOption "GLSL language support";
treesitter = {
enable = mkEnableOption "GLSL treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "glsl";
};
lsp = {
enable = mkEnableOption "GLSL LSP support" // {default = config.vim.lsp.enable;};
servers = mkOption {
type = listOf (enum (attrNames servers));
default = defaultServers;
description = "GLSL LSP server to use";
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter = {
enable = true;
grammars = [cfg.treesitter.package];
};
})
(mkIf cfg.lsp.enable {
vim.lsp.servers =
mapListToAttrs (n: {
name = n;
value = servers.${n};
})
cfg.lsp.servers;
})
]);
}

View file

@ -10,7 +10,7 @@
inherit (lib.meta) getExe;
inherit (lib.generators) mkLuaInline;
inherit (lib.types) bool enum package;
inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf;
inherit (lib.nvim.types) mkGrammarOption diagnostics deprecatedSingleOrListOf;
inherit (lib.nvim.dag) entryAfter;
inherit (lib.nvim.attrsets) mapListToAttrs;
@ -20,7 +20,7 @@
servers = {
gopls = {
cmd = [(getExe pkgs.gopls)];
filetypes = ["go" "gomod" "gowork" "gotmpl"];
filetypes = ["go" "gomod" "gosum" "gowork" "gotmpl"];
root_dir = mkLuaInline ''
function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
@ -78,6 +78,91 @@
package = pkgs.delve;
};
};
defaultDiagnosticsProvider = ["golangci-lint"];
diagnosticsProviders = {
golangci-lint = let
pkg = pkgs.golangci-lint;
in {
package = pkg;
config = {
cmd = getExe pkg;
args = [
"run"
"--output.json.path=stdout"
"--issues-exit-code=0"
"--show-stats=false"
"--fix=false"
"--path-mode=abs"
# Overwrite values that could be configured and result in unwanted writes
"--output.text.path="
"--output.tab.path="
"--output.html.path="
"--output.checkstyle.path="
"--output.code-climate.path="
"--output.junit-xml.path="
"--output.teamcity.path="
"--output.sarif.path="
];
parser = mkLuaInline ''
function(output, bufnr)
local SOURCE = "golangci-lint";
local function display_tool_error(msg)
return{
{
bufnr = bufnr,
lnum = 0,
col = 0,
message = string.format("[%s] %s", SOURCE, msg),
severity = vim.diagnostic.severity.ERROR,
source = SOURCE,
},
}
end
if output == "" then
return display_tool_error("no output provided")
end
local ok, decoded = pcall(vim.json.decode, output)
if not ok then
return display_tool_error("failed to parse JSON output")
end
if not decoded or not decoded.Issues then
return display_tool_error("unexpected output format")
end
local severity_map = {
error = vim.diagnostic.severity.ERROR,
warning = vim.diagnostic.severity.WARN,
info = vim.diagnostic.severity.INFO,
hint = vim.diagnostic.severity.HINT,
}
local diagnostics = {}
for _, issue in ipairs(decoded.Issues) do
local sev = vim.diagnostic.severity.ERROR
if issue.Severity and issue.Severity ~= "" then
local normalized = issue.Severity:lower()
sev = severity_map[normalized] or vim.diagnostic.severity.ERROR
end
table.insert(diagnostics, {
bufnr = bufnr,
lnum = issue.Pos.Line - 1,
col = issue.Pos.Column - 1,
message = issue.Text,
code = issue.FromLinter,
severity = sev,
source = SOURCE,
})
end
return diagnostics
end
'';
};
};
};
in {
options.vim.languages.go = {
enable = mkEnableOption "Go language support";
@ -85,7 +170,11 @@ in {
treesitter = {
enable = mkEnableOption "Go treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "go";
goPackage = mkGrammarOption pkgs "go";
gomodPackage = mkGrammarOption pkgs "gomod";
gosumPackage = mkGrammarOption pkgs "gosum";
goworkPackage = mkGrammarOption pkgs "gowork";
gotmplPackage = mkGrammarOption pkgs "gotmpl";
};
lsp = {
@ -134,12 +223,26 @@ in {
default = debuggers.${cfg.dap.debugger}.package;
};
};
extraDiagnostics = {
enable = mkEnableOption "extra Go diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
types = diagnostics {
langDesc = "Go";
inherit diagnosticsProviders;
inherit defaultDiagnosticsProvider;
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
vim.treesitter.grammars = [
cfg.treesitter.goPackage
cfg.treesitter.gomodPackage
cfg.treesitter.gosumPackage
cfg.treesitter.goworkPackage
cfg.treesitter.gotmplPackage
];
})
(mkIf cfg.lsp.enable {
@ -179,5 +282,15 @@ in {
debugger.nvim-dap.enable = true;
};
})
(mkIf cfg.extraDiagnostics.enable {
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.go = cfg.extraDiagnostics.types;
linters =
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
cfg.extraDiagnostics.types);
};
})
]);
}

View file

@ -84,9 +84,14 @@ in {
end
})
local ft = require('Comment.ft')
ft
.set('hcl', '#%s')
${
if config.vim.comments.comment-nvim.enable
then ''
local ft = require('Comment.ft')
ft.set('hcl', '#%s')
''
else ""
}
'';
}

View file

@ -0,0 +1,65 @@
{
config,
pkgs,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) enum listOf;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.attrsets) mapListToAttrs;
cfg = config.vim.languages.jinja;
defaultServers = ["jinja-lsp"];
servers = {
jinja-lsp = {
enable = true;
cmd = [(getExe pkgs.jinja-lsp)];
filetypes = ["jinja"];
root_markers = [
".git"
];
};
};
in {
options.vim.languages.jinja = {
enable = mkEnableOption "Jinja template language support";
treesitter = {
enable = mkEnableOption "Jinja treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "jinja";
inlinePackage = mkGrammarOption pkgs "jinja_inline";
};
lsp = {
enable = mkEnableOption "Jinja LSP support" // {default = config.vim.lsp.enable;};
servers = mkOption {
description = "Jinja LSP server to use";
type = listOf (enum (attrNames servers));
default = defaultServers;
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [
cfg.treesitter.package
cfg.treesitter.inlinePackage
];
})
(mkIf cfg.lsp.enable {
vim.lsp.servers =
mapListToAttrs (n: {
name = n;
value = servers.${n};
})
cfg.lsp.servers;
})
]);
}

View file

@ -0,0 +1,93 @@
{
config,
lib,
pkgs,
...
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.meta) getExe;
inherit (lib.types) listOf enum;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.types) mkGrammarOption diagnostics;
inherit (lib.nvim.attrsets) mapListToAttrs;
cfg = config.vim.languages.make;
defaultFormat = ["bake"];
formats = {
bake = {
command = "${pkgs.mbake}/bin/mbake";
};
};
defaultDiagnosticsProvider = ["checkmake"];
diagnosticsProviders = {
checkmake = {
config = {
cmd = getExe pkgs.checkmake;
};
};
};
in {
options.vim.languages.make = {
enable = mkEnableOption "Make support";
treesitter = {
enable = mkEnableOption "Make treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "make";
};
format = {
enable = mkEnableOption "Make formatting" // {default = config.vim.languages.enableFormat;};
type = mkOption {
description = "make formatter to use";
type = listOf (enum (attrNames formats));
default = defaultFormat;
};
};
extraDiagnostics = {
enable = mkEnableOption "extra Make diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
types = diagnostics {
langDesc = "Make";
inherit diagnosticsProviders;
inherit defaultDiagnosticsProvider;
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter = {
enable = true;
grammars = [cfg.treesitter.package];
};
})
(mkIf cfg.format.enable {
vim.formatter.conform-nvim = {
enable = true;
setupOpts = {
formatters_by_ft.make = cfg.format.type;
formatters =
mapListToAttrs (name: {
inherit name;
value = formats.${name};
})
cfg.format.type;
};
};
})
(mkIf cfg.extraDiagnostics.enable {
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.make = cfg.extraDiagnostics.types;
linters =
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
cfg.extraDiagnostics.types);
};
})
]);
}

View file

@ -5,7 +5,7 @@
...
}: let
inherit (builtins) attrNames;
inherit (lib.meta) getExe;
inherit (lib.meta) getExe getExe';
inherit (lib.modules) mkIf mkMerge;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) bool enum listOf str nullOr;
@ -55,6 +55,15 @@
prettierd = {
command = getExe pkgs.prettierd;
};
mdformat = {
command = getExe' (pkgs.python313Packages.python.withPackages (p:
with p; [
mdformat
mdformat-gfm
mdformat-frontmatter
mdformat-footnote
])) "mdformat";
};
};
defaultDiagnosticsProvider = ["markdownlint-cli2"];
diagnosticsProviders = {

View file

@ -7,12 +7,15 @@
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.types) enum;
inherit (lib.types) enum package;
inherit (lib.nvim.dag) entryAfter;
inherit (lib.meta) getExe;
inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.attrsets) mapListToAttrs;
cfg = config.vim.languages.odin;
defaultServers = ["ols"];
servers = {
ols = {
@ -32,7 +35,19 @@
};
};
cfg = config.vim.languages.odin;
defaultDebugger = "codelldb";
debuggers = {
codelldb = {
package = pkgs.lldb;
dapConfig = ''
dap.adapters.codelldb = {
type = 'executable',
command = '${cfg.dap.package}/bin/lldb-dap',
name = 'codelldb'
}
'';
};
};
in {
options.vim.languages.odin = {
enable = mkEnableOption "Odin language support";
@ -51,6 +66,22 @@ in {
description = "Odin LSP server to use";
};
};
dap = {
enable = mkEnableOption "Enable Odin Debug Adapter" // {default = config.vim.languages.enableDAP;};
debugger = mkOption {
description = "Odin debugger to use";
type = enum (attrNames debuggers);
default = defaultDebugger;
};
package = mkOption {
description = "Odin debugger package.";
type = package;
default = debuggers.${cfg.dap.debugger}.package;
};
};
};
config = mkIf cfg.enable (mkMerge [
@ -67,5 +98,18 @@ in {
})
cfg.lsp.servers;
})
(mkIf cfg.dap.enable {
vim = {
startPlugins = ["nvim-dap-odin"];
debugger.nvim-dap.sources.odin-debugger = debuggers.${cfg.dap.debugger}.dapConfig;
pluginRC.nvim-dap-odin = entryAfter ["nvim-dap"] ''
require('nvim-dap-odin').setup({
notifications = false -- contains no useful information
})
'';
debugger.nvim-dap.enable = true;
};
})
]);
}

View file

@ -4,11 +4,12 @@
lib,
...
}: let
inherit (builtins) attrNames;
inherit (builtins) attrNames toString;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.types) enum;
inherit (lib.types) enum int attrs listOf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf;
inherit (lib.nvim.attrsets) mapListToAttrs;
inherit (lib.generators) mkLuaInline;
@ -64,6 +65,21 @@
root_markers = ["composer.json" ".git"];
};
};
defaultFormat = ["php_cs_fixer"];
formats = {
php_cs_fixer = {
/*
Using 8.4 instead of 8.5 because of compatibility:
```logs
2026-02-08 00:42:23[ERROR] Formatter 'php_cs_fixer' error: PHP CS Fixer 3.87.2
PHP runtime: 8.5.2
PHP CS Fixer currently supports PHP syntax only up to PHP 8.4, current PHP version: 8.5.2.
```
*/
command = "${pkgs.php84Packages.php-cs-fixer}/bin/php-cs-fixer";
};
};
in {
options.vim.languages.php = {
enable = mkEnableOption "PHP language support";
@ -82,6 +98,38 @@ in {
description = "PHP LSP server to use";
};
};
format = {
enable = mkEnableOption "PHP formatting" // {default = config.vim.languages.enableFormat;};
type = mkOption {
description = "PHP formatter to use";
type = listOf (enum (attrNames formats));
default = defaultFormat;
};
};
dap = {
enable = mkEnableOption "Enable PHP Debug Adapter" // {default = config.vim.languages.enableDAP;};
xdebug = {
adapter = mkOption {
type = attrs;
default = {
type = "executable";
command = "${pkgs.nodePackages_latest.nodejs}/bin/node";
args = [
"${pkgs.vscode-extensions.xdebug.php-debug}/share/vscode/extensions/xdebug.php-debug/out/phpDebug.js"
];
};
description = "XDebug adapter to use for nvim-dap";
};
port = mkOption {
type = int;
default = 9003;
description = "Port to use for XDebug";
};
};
};
};
config = mkIf cfg.enable (mkMerge [
@ -98,5 +146,39 @@ in {
})
cfg.lsp.servers;
})
(mkIf cfg.format.enable {
vim.formatter.conform-nvim = {
enable = true;
setupOpts = {
formatters_by_ft.php = cfg.format.type;
formatters =
mapListToAttrs (name: {
inherit name;
value = formats.${name};
})
cfg.format.type;
};
};
})
(mkIf cfg.dap.enable {
vim = {
debugger.nvim-dap = {
enable = true;
sources.php-debugger = ''
dap.adapters.xdebug = ${toLuaObject cfg.dap.xdebug.adapter}
dap.configurations.php = {
{
type = 'xdebug',
request = 'launch',
name = 'Listen for XDebug',
port = ${toString cfg.dap.xdebug.port},
},
}
'';
};
};
})
]);
}

View file

@ -11,7 +11,7 @@
inherit (lib.modules) mkIf mkMerge;
inherit (lib.types) enum package bool;
inherit (lib.nvim.attrsets) mapListToAttrs;
inherit (lib.nvim.types) deprecatedSingleOrListOf;
inherit (lib.nvim.types) deprecatedSingleOrListOf diagnostics;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.dag) entryBefore;
inherit (lib.trivial) warn;
@ -278,6 +278,14 @@
'';
};
};
defaultDiagnosticsProvider = ["mypy"];
diagnosticsProviders = {
mypy = {
config = {
cmd = getExe' pkgs.mypy "mypy";
};
};
};
in {
options.vim.languages.python = {
enable = mkEnableOption "Python language support";
@ -335,6 +343,15 @@ in {
'';
};
};
extraDiagnostics = {
enable = mkEnableOption "extra Python diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
types = diagnostics {
langDesc = "Python";
inherit diagnosticsProviders;
inherit defaultDiagnosticsProvider;
};
};
};
config = mkIf cfg.enable (mkMerge [
@ -404,5 +421,15 @@ in {
vim.debugger.nvim-dap.enable = true;
vim.debugger.nvim-dap.sources.python-debugger = debuggers.${cfg.dap.debugger}.dapConfig;
})
(mkIf cfg.extraDiagnostics.enable {
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.python = cfg.extraDiagnostics.types;
linters =
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
cfg.extraDiagnostics.types);
};
})
]);
}

View file

@ -11,7 +11,7 @@
inherit (lib.lists) isList;
inherit (lib.attrsets) attrNames;
inherit (lib.types) bool package str listOf either enum int;
inherit (lib.nvim.lua) expToLua toLuaObject;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.attrsets) mapListToAttrs;
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption deprecatedSingleOrListOf;
inherit (lib.nvim.dag) entryAfter entryAnywhere;
@ -169,7 +169,7 @@ in {
server = {
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
then toLuaObject cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
},
default_settings = {
@ -228,10 +228,17 @@ in {
(mkIf cfg.extensions.crates-nvim.enable {
vim = mkMerge [
{
startPlugins = ["crates-nvim"];
pluginRC.rust-crates = entryAnywhere ''
require("crates").setup(${toLuaObject cfg.extensions.crates-nvim.setupOpts})
'';
lazy.plugins.crates-nvim = {
package = "crates-nvim";
setupModule = "crates";
setupOpts = cfg.extensions.crates-nvim.setupOpts;
event = [
{
event = "BufRead";
pattern = "Cargo.toml";
}
];
};
}
];
})

View file

@ -0,0 +1,28 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib.options) mkEnableOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.types) mkGrammarOption;
cfg = config.vim.languages.tera;
in {
options.vim.languages.tera = {
enable = mkEnableOption "Tera templating language support";
treesitter = {
enable = mkEnableOption "Tera treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "tera";
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
]);
}

View file

@ -8,12 +8,12 @@
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) bool enum;
inherit (lib.types) enum;
inherit (lib.nvim.types) diagnostics mkGrammarOption deprecatedSingleOrListOf;
inherit (lib.nvim.attrsets) mapListToAttrs;
cfg = config.vim.languages.toml;
defaultServers = ["tombi"];
defaultServers = ["taplo"];
servers = {
tombi = {
enable = true;
@ -27,9 +27,21 @@
".git"
];
};
taplo = {
enable = true;
cmd = [
(getExe pkgs.taplo)
"lsp"
"stdio"
];
filetypes = ["toml"];
root_markers = [
".git"
];
};
};
defaultFormat = ["tombi"];
defaultFormat = ["taplo"];
formats = {
tombi = {
command = getExe pkgs.tombi;
@ -40,6 +52,15 @@
"-"
];
};
taplo = {
command = getExe pkgs.taplo;
args = [
"format"
"--stdin-filepath"
"$FILENAME"
"-"
];
};
};
defaultDiagnosticsProvider = ["tombi"];
diagnosticsProviders = {

View file

@ -0,0 +1,62 @@
{
config,
pkgs,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.types) enum listOf;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.attrsets) mapListToAttrs;
cfg = config.vim.languages.xml;
defaultServers = ["lemminx"];
servers = {
lemminx = {
enable = true;
cmd = [
(getExe pkgs.lemminx)
];
filetypes = ["xml"];
root_markers = [".git"];
};
};
in {
options.vim.languages.xml = {
enable = mkEnableOption "XML language support";
treesitter = {
enable = mkEnableOption "XML treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "xml";
};
lsp = {
enable = mkEnableOption "XML LSP support" // {default = config.vim.lsp.enable;};
servers = mkOption {
type = listOf (enum (attrNames servers));
default = defaultServers;
description = "XML LSP server to use";
};
};
};
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.servers =
mapListToAttrs (name: {
inherit name;
value = servers.${name};
})
cfg.lsp.servers;
})
]);
}

View file

@ -48,7 +48,7 @@ in {
default_on_attach(client, bufnr)
${optionalString cfg.inlayHints.enable ''
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr })
end
''}

View file

@ -11,9 +11,47 @@
in {
config = mkIf (cfg.enable && cfg.harper-ls.enable) {
vim.lsp.servers.harper-ls = {
root_markers = [".git"];
root_markers = [".git" ".harper-dictionary.txt"];
cmd = [(getExe pkgs.harper) "--stdio"];
settings = {harper-ls = cfg.harper-ls.settings;};
filetypes =
# <https://writewithharper.com/docs/integrations/language-server#Supported-Languages>
[
"asciidoc"
"c"
"clojure"
"cmake"
"cpp"
"cs"
"daml"
"dart"
"gitcommit"
"go"
"haskell"
"html"
"ink"
"java"
"javascript"
"javascriptreact"
"kotlin"
"lhaskell"
"lua"
"mail"
"markdown"
"nix"
"php"
"python"
"ruby"
"rust"
"scala"
"sh"
"swift"
"text"
"toml"
"typescript"
"typescriptreact"
"typst"
];
};
};
}

View file

@ -1,6 +1,7 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.minimap.codewindow = {
enable = mkEnableOption "codewindow plugin for minimap view";
@ -11,5 +12,7 @@ in {
toggle = mkMappingOption "Toggle minimap [codewindow]" "<leader>mm";
toggleFocus = mkMappingOption "Toggle minimap focus [codewindow]" "<leader>mf";
};
setupOpts = mkPluginSetupOption "codewindow" {};
};
}

View file

@ -6,6 +6,7 @@
}: let
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding pushDownDefault;
cfg = config.vim.minimap.codewindow;
@ -32,9 +33,7 @@ in {
pluginRC.codewindow = entryAnywhere ''
local codewindow = require('codewindow')
codewindow.setup({
exclude_filetypes = { 'NvimTree', 'orgagenda', 'Alpha'},
})
codewindow.setup(${toLuaObject cfg.setupOpts})
'';
};
};

View file

@ -80,7 +80,7 @@
mode = mkOption {
description = "Set the display mode";
type = nullOr (enum ["foreground" "background"]);
type = nullOr (enum ["foreground" "background" "virtualtext"]);
default = null;
};

View file

@ -6,8 +6,6 @@
}: let
inherit (lib.modules) mkIf;
inherit (lib.lists) optionals;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.ui.noice;
tscfg = config.vim.treesitter;
@ -16,16 +14,15 @@
in {
config = mkIf cfg.enable {
vim = {
startPlugins = [
"noice-nvim"
"nui-nvim"
];
startPlugins = ["nui-nvim"];
treesitter.grammars = optionals tscfg.addDefaultGrammars defaultGrammars;
pluginRC.noice-nvim = entryAnywhere ''
require("noice").setup(${toLuaObject cfg.setupOpts})
'';
lazy.plugins.noice-nvim = {
package = "noice-nvim";
setupModule = "noice";
event = ["DeferredUIEnter"];
inherit (cfg) setupOpts;
};
};
};
}

View file

@ -9,6 +9,7 @@
./harpoon
./icon-picker
./images
./grug-far-nvim
./leetcode-nvim
./mkdir
./motion

View file

@ -0,0 +1,21 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.utility.grug-far-nvim;
in {
config = {
vim.lazy.plugins.grug-far-nvim = mkIf cfg.enable {
package = "grug-far-nvim";
cmd = [
"GrugFar"
"GrugFarWithin"
];
setupModule = "grug-far";
setupOpts = cfg.setupOpts;
};
};
}

View file

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

View file

@ -0,0 +1,9 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.utility.grug-far-nvim = {
enable = mkEnableOption "grug-far";
setupOpts = mkPluginSetupOption "grug-far" {};
};
}

View file

@ -15,7 +15,7 @@ in {
"img-clip"
];
pluginRC.image-nvim = entryAnywhere ''
pluginRC.img-clip = entryAnywhere ''
require("img-clip").setup(${toLuaObject cfg.setupOpts})
'';
};

View file

@ -0,0 +1,9 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.visuals.blink-indent = {
enable = mkEnableOption "indentation guides [blink-indent]";
setupOpts = mkPluginSetupOption "blink-indent" {};
};
}

View file

@ -0,0 +1,19 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.visuals.blink-indent;
in {
config = mkIf cfg.enable {
vim.lazy.plugins.blink-indent = {
package = "blink-indent";
setupModule = "blink.indent";
inherit (cfg) setupOpts;
event = ["BufEnter"];
};
};
}

View file

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

View file

@ -7,6 +7,7 @@ in {
toggles under individual options.
'')
./blink-indent
./cellular-automaton
./cinnamon-nvim
./fidget-nvim
@ -18,5 +19,6 @@ in {
./nvim-web-devicons
./rainbow-delimiters
./tiny-devicons-auto-colors
./syntax-gaslighting
];
}

View file

@ -4,18 +4,17 @@
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.visuals.nvim-web-devicons;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["nvim-web-devicons"];
pluginRC.nvim-web-devicons = entryAnywhere ''
require("nvim-web-devicons").setup(${toLuaObject cfg.setupOpts})
'';
lazy.plugins.nvim-web-devicons = {
package = "nvim-web-devicons";
setupModule = "nvim-web-devicons";
event = ["DeferredUIEnter"];
inherit (cfg) setupOpts;
};
};
};
}

View file

@ -1,6 +1,6 @@
{lib, ...}: let
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) nullOr attrsOf attrs enum;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
@ -16,27 +16,27 @@ in {
variant = mkOption {
type = nullOr (enum ["light" "dark"]);
default = null;
description = "Set the light or dark variant manually, instead of relying on `background`";
description = ''
Set the light or dark variant manually, instead of relying on `background`
'';
};
override = mkOption {
type = attrsOf attrs;
default = {};
example = literalExpression ''
{
zsh = {
name = "Zsh";
icon = "";
color = "#428850";
cterm_color = "65";
};
}
'';
example = {
zsh = {
name = "Zsh";
icon = "";
color = "#428850";
cterm_color = "65";
};
};
description = ''
Your personal icon overrides.
You can specify color or cterm_color instead of specifying
both of them. DevIcon will be appended to `name`
You can specify color or `cterm_color` instead of specifying both of
them. `DevIcon` will be appended to `name`
'';
};
};

View file

@ -0,0 +1,20 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.visuals.syntax-gaslighting;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["syntax-gaslighting"];
pluginRC.colorful-menu-nvim = entryAnywhere ''
require("syntax-gaslighting").setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

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

View file

@ -0,0 +1,28 @@
{lib, ...}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) str nullOr listOf bool;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.visuals = {
syntax-gaslighting = {
enable = mkEnableOption "Thats no even a real option, you're crazy.";
setupOpts = mkPluginSetupOption "syntax-gaslighting" {
messages = mkOption {
type = nullOr (listOf str);
default = null;
description = "Custom messages for gaslighting.";
};
merge_messages = mkOption {
type = bool;
default = false;
description = ''
Merge user messages with the default ones.
If disabled, the messages table will override default messages.
'';
};
};
};
};
}

View file

@ -11,7 +11,8 @@
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["tiny-devicons-auto-colors-nvim" "nvim-web-devicons"];
startPlugins = ["tiny-devicons-auto-colors-nvim"];
visuals.nvim-web-devicons.enable = true;
pluginRC.tiny-devicons-auto-colors = entryAnywhere ''
require("tiny-devicons-auto-colors").setup(${toLuaObject cfg.setupOpts})

View file

@ -9,7 +9,7 @@
inherit (lib.trivial) flip;
inherit (builtins) filter isString hasAttr getAttr;
getPin = flip getAttr (pkgs.callPackages ../../../npins/sources.nix {});
getPin = flip getAttr (inputs.mnw.lib.npinsToPluginsAttrs pkgs ../../../npins/sources.json);
# Build a Vim plugin with the given name and arguments.
buildPlug = attrs: let
@ -94,7 +94,7 @@
nodeJs.enable = config.vim.withNodeJs;
python3 = {
enable = config.vim.withPython3;
extraPackages = ps: map (flip builtins.getAttr ps) config.vim.python3Packages;
extraPackages = ps: (map (flip builtins.getAttr ps) config.vim.python3Packages) ++ [ps.pynvim];
};
};

View file

@ -106,16 +106,9 @@ in {
'';
};
# This defaults to `true` in the wrapper
# and since we pass this value to the wrapper
# with an inherit, it should be `true` here as well
withRuby =
mkEnableOption ''
Ruby support in the Neovim wrapper.
''
// {
default = true;
};
withRuby = mkEnableOption ''
Ruby support in the Neovim wrapper
'';
withNodeJs = mkEnableOption ''
NodeJS support in the Neovim wrapper

View file

@ -39,6 +39,7 @@ in {
getOpts = keymap: {
inherit (keymap) desc silent nowait script expr unique noremap;
remap = !keymap.noremap;
};
toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})";

View file

@ -91,6 +91,19 @@
"url": "https://github.com/moyiz/blink-emoji.nvim/archive/f22ce8cac02a6ece05368220f1e38bd34fe376f9.tar.gz",
"hash": "sha256-pPHESNsByHg2liNUYkUEVR1wP1MZcil1sKTqrNI53e4="
},
"blink-indent": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "saghen",
"repo": "blink.indent"
},
"branch": "main",
"submodules": false,
"revision": "9c80820ca77218a8d28e70075d6f44a1609911fe",
"url": "https://github.com/saghen/blink.indent/archive/9c80820ca77218a8d28e70075d6f44a1609911fe.tar.gz",
"hash": "sha256-SS66JZFCX8viYxYaObASlwtrG5h7yHbVvRBVXBNXkng="
},
"blink-ripgrep-nvim": {
"type": "Git",
"repository": {
@ -643,6 +656,19 @@
"url": "https://github.com/ellisonleao/glow.nvim/archive/5d5954b2f22e109d4a6eba8b2618c5b96e4ee7a2.tar.gz",
"hash": "sha256-CvBcmVWBgI+m+PS7p7PmsiPtTEfqx2kpIzz4mImONIc="
},
"grug-far-nvim": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "MagicDuck",
"repo": "grug-far.nvim"
},
"branch": "main",
"submodules": false,
"revision": "275dbedc96e61a6b8d1dfb28ba51586ddd233dcf",
"url": "https://github.com/MagicDuck/grug-far.nvim/archive/275dbedc96e61a6b8d1dfb28ba51586ddd233dcf.tar.gz",
"hash": "sha256-qn1BTNCX0Sm158Lv5JfHThqlJX9ualCIlc+RCjWa+t8="
},
"gruvbox": {
"type": "Git",
"repository": {
@ -973,9 +999,9 @@
},
"branch": "main",
"submodules": false,
"revision": "de79a7626d54d7785436105ef72f37ee8fe8fa16",
"url": "https://github.com/OXY2DEV/markview.nvim/archive/de79a7626d54d7785436105ef72f37ee8fe8fa16.tar.gz",
"hash": "sha256-kGhohG4Aw9wMceLiX+s2HCWIyWuJYHoa9D80elM1UQw="
"revision": "c81ce9ed129387fc5fdec91abe9818a1b0e6fcac",
"url": "https://github.com/OXY2DEV/markview.nvim/archive/c81ce9ed129387fc5fdec91abe9818a1b0e6fcac.tar.gz",
"hash": "sha256-CoPfVkPWh5neyIT1rVEHMLo7532lWvbv0Gg/27D0PHw="
},
"mellow": {
"type": "Git",
@ -1860,6 +1886,19 @@
"url": "https://github.com/leoluz/nvim-dap-go/archive/b4421153ead5d726603b02743ea40cf26a51ed5f.tar.gz",
"hash": "sha256-wg9kiW2eAMmg4bvgqaAS9kt7qaVsIWl36BNqRbhZIgo="
},
"nvim-dap-odin": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "NANDquark",
"repo": "nvim-dap-odin"
},
"branch": "main",
"submodules": false,
"revision": "4df40d467f4ea5195e2f3b813d970eb15172b052",
"url": "https://github.com/NANDquark/nvim-dap-odin/archive/4df40d467f4ea5195e2f3b813d970eb15172b052.tar.gz",
"hash": "sha256-/bW22gWrPamK4jDMJYDv/3od+vIUb/eYICnHWnv8MVU="
},
"nvim-dap-ui": {
"type": "Git",
"repository": {
@ -2116,9 +2155,9 @@
},
"branch": "master",
"submodules": false,
"revision": "b8221e42cf7287c4dcde81f232f58d7b947c210d",
"url": "https://github.com/nvim-tree/nvim-web-devicons/archive/b8221e42cf7287c4dcde81f232f58d7b947c210d.tar.gz",
"hash": "sha256-lVrakFrpIP9lp7sMfMb33KeMPIkcn1qBFVytJzKCfuE="
"revision": "746ffbb17975ebd6c40142362eee1b0249969c5c",
"url": "https://github.com/nvim-tree/nvim-web-devicons/archive/746ffbb17975ebd6c40142362eee1b0249969c5c.tar.gz",
"hash": "sha256-jXWBPcfLwSkWQ/eRbxVDWC7kFOODSsCRmzC3rHKQLhQ="
},
"obsidian-nvim": {
"type": "GitRelease",
@ -2528,6 +2567,19 @@
"url": "https://github.com/supermaven-inc/supermaven-nvim/archive/07d20fce48a5629686aefb0a7cd4b25e33947d50.tar.gz",
"hash": "sha256-1z3WKIiikQqoweReUyK5O8MWSRN5y95qcxM6qzlKMME="
},
"syntax-gaslighting": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "NotAShelf",
"repo": "syntax-gaslighting.nvim"
},
"branch": "main",
"submodules": false,
"revision": "4cee4c0550e82b31e07424e0c44379920d716d79",
"url": "https://github.com/NotAShelf/syntax-gaslighting.nvim/archive/4cee4c0550e82b31e07424e0c44379920d716d79.tar.gz",
"hash": "sha256-sRg6UlK4hQubxf3ycGnMLi+tNvX3zvKgnHYVuZgmvOc="
},
"tabular": {
"type": "Git",
"repository": {

View file

@ -1,115 +0,0 @@
{
lib,
fetchurl,
fetchgit,
fetchzip,
}:
builtins.mapAttrs
(
name: spec: let
mayOverride = name: path: let
envVarName = "NPINS_OVERRIDE_${saneName}";
saneName = builtins.concatStringsSep "_" (
builtins.concatLists (
builtins.filter (x: builtins.isList x && x != [""]) (builtins.split "([a-zA-Z0-9]*)" name)
)
);
ersatz = builtins.getEnv envVarName;
in
if ersatz == ""
then path
else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" (
if builtins.substring 0 1 ersatz == "/"
then /. + ersatz
else /. + builtins.getEnv "PWD" + "/${ersatz}"
);
path =
rec {
GitRelease = Git;
Channel = Tarball;
Git =
if spec.url != null && !spec.submodules
then Tarball
else
fetchgit (
let
repo = spec.repository;
url =
{
Git = repo.url;
GitHub = "https://github.com/${repo.owner}/${repo.repo}.git";
GitLab = "${repo.server}/${repo.repo_path}.git";
Forgejo = "${repo.server}/${repo.owner}/${repo.repo}.git";
}
.${
repo.type
} or (throw "Unrecognized repository type ${repo.type}");
in {
name = let
matched = builtins.match "^.*/([^/]*)(\\.git)?$" url;
appendShort =
if (builtins.match "[a-f0-9]*" spec.revision) != null
then "-${builtins.substring 0 7 spec.revision}"
else "";
in "${
if matched == null
then "source"
else builtins.head matched
}${appendShort}";
inherit url;
rev = spec.revision;
inherit (spec) hash;
fetchSubmodules = spec.submodules;
}
);
PyPi = fetchurl {
inherit (spec) url hash;
};
Tarball = fetchzip {
inherit (spec) url hash;
extension = "tar";
};
}
.${
spec.type
} or (builtins.throw "Unknown source type ${spec.type}");
version =
if spec ? revision
then builtins.substring 0 8 spec.revision
else "0";
in
spec
// {
name = "${name}-${version}";
pname = name;
inherit version;
outPath =
(
# Override logic won't do anything if we're in pure eval
if builtins ? currentSystem
then mayOverride name path
else path
).overrideAttrs
{
pname = name;
name = "${name}-${version}";
inherit version;
};
}
)
(
let
json = lib.importJSON ./sources.json;
in
assert lib.assertMsg (json.version == 7) "Unsupported format version ${toString json.version} in sources.json. Try running `npins upgrade`";
json.pins
)