mirror of
https://github.com/traxys/Nixfiles.git
synced 2026-02-19 13:20:57 +01:00
neovim: Stop following neovim nightly
This commit is contained in:
parent
638950180d
commit
1bed28a1d4
8 changed files with 57 additions and 4458 deletions
7
.github/workflows/update.yaml
vendored
7
.github/workflows/update.yaml
vendored
|
|
@ -27,10 +27,3 @@ jobs:
|
|||
with:
|
||||
labels: automerge
|
||||
number: ${{ steps.update.outputs.pull-request-number }}
|
||||
- name: Update nvim-treesitter
|
||||
run: |
|
||||
git checkout update_flake_lock_action
|
||||
nix run .\#update-nvim-treesitter -- neovim/nvim-treesitter
|
||||
git add neovim/nvim-treesitter
|
||||
git commit -m "neovim: Update nvim-treesitter parsers"
|
||||
git push
|
||||
|
|
|
|||
928
flake.lock
generated
928
flake.lock
generated
File diff suppressed because it is too large
Load diff
200
flake.nix
200
flake.nix
|
|
@ -90,11 +90,6 @@
|
|||
};
|
||||
fioul.url = "github:traxys/fioul";
|
||||
|
||||
neovim-flake = {
|
||||
url = "github:neovim/neovim?dir=contrib";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nixvim = {
|
||||
url = "github:nix-community/nixvim";
|
||||
#url = "/home/traxys/Documents/nixvim";
|
||||
|
|
@ -102,198 +97,7 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Neovim plugins
|
||||
"plugin:clangd_extensions-nvim" = {
|
||||
url = "github:p00f/clangd_extensions.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:netman-nvim" = {
|
||||
url = "github:miversen33/netman.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:cmp-buffer" = {
|
||||
url = "github:hrsh7th/cmp-buffer";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:cmp-calc" = {
|
||||
url = "github:hrsh7th/cmp-calc";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:cmp-nvim-lsp" = {
|
||||
url = "github:hrsh7th/cmp-nvim-lsp";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:cmp-path" = {
|
||||
url = "github:hrsh7th/cmp-path";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:cmp_luasnip" = {
|
||||
url = "github:saadparwaiz1/cmp_luasnip";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:comment-nvim" = {
|
||||
url = "github:numtostr/comment.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:firenvim" = {
|
||||
url = "github:glacambre/firenvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:git-messenger-vim" = {
|
||||
url = "github:rhysd/git-messenger.vim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:gitsigns-nvim" = {
|
||||
url = "github:lewis6991/gitsigns.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:inc-rename-nvim" = {
|
||||
url = "github:smjonas/inc-rename.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:indent-blankline-nvim" = {
|
||||
url = "github:lukas-reineke/indent-blankline.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:lspkind-nvim" = {
|
||||
url = "github:onsails/lspkind.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:lualine-nvim" = {
|
||||
url = "github:nvim-lualine/lualine.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:noice-nvim" = {
|
||||
url = "github:folke/noice.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:nui-nvim" = {
|
||||
url = "github:MunifTanjim/nui.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:nvim-cmp" = {
|
||||
url = "github:hrsh7th/nvim-cmp";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:nvim-lightbulb" = {
|
||||
url = "github:kosayoda/nvim-lightbulb";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:nvim-lspconfig" = {
|
||||
url = "github:neovim/nvim-lspconfig";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:nvim-notify" = {
|
||||
url = "github:rcarriga/nvim-notify";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:nvim-osc52" = {
|
||||
url = "github:ojroques/nvim-osc52";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:nvim-tree-lua" = {
|
||||
url = "github:nvim-tree/nvim-tree.lua";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:nvim-treesitter-context" = {
|
||||
url = "github:nvim-treesitter/nvim-treesitter-context";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:nvim-treesitter-refactor" = {
|
||||
url = "github:nvim-treesitter/nvim-treesitter-refactor";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:plantuml-syntax" = {
|
||||
url = "github:aklt/plantuml-syntax";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:plenary-nvim" = {
|
||||
url = "github:nvim-lua/plenary.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:rustaceanvim" = {
|
||||
url = "github:mrcjkb/rustaceanvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:telescope-nvim" = {
|
||||
url = "github:nvim-telescope/telescope.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:telescope-ui-select-nvim" = {
|
||||
url = "github:nvim-telescope/telescope-ui-select.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:trouble-nvim" = {
|
||||
url = "github:folke/trouble.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:vim-matchup" = {
|
||||
url = "github:andymass/vim-matchup";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:luasnip" = {
|
||||
url = "github:L3MON4D3/LuaSnip";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:nvim-treesitter" = {
|
||||
url = "github:nvim-treesitter/nvim-treesitter";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:openscad-nvim" = {
|
||||
url = "github:salkin-mada/openscad.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:neo-tree-nvim" = {
|
||||
url = "github:nvim-neo-tree/neo-tree.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:nvim-web-devicons" = {
|
||||
url = "github:nvim-tree/nvim-web-devicons";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:popup-nvim" = {
|
||||
url = "github:nvim-lua/popup.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:skim-vim" = {
|
||||
url = "github:lotabout/skim.vim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:tokyonight-nvim" = {
|
||||
url = "github:folke/tokyonight.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:vim-snippets" = {
|
||||
url = "github:honza/vim-snippets";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:markdown-preview-nvim" = {
|
||||
url = "github:iamcco/markdown-preview.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:which-key-nvim" = {
|
||||
url = "github:folke/which-key.nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:zk-nvim" = {
|
||||
url = "github:mickael-menu/zk-nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:efmls-configs-nvim" = {
|
||||
url = "github:creativenull/efmls-configs-nvim";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:vim-just" = {
|
||||
url = "github:NoahTheDuke/vim-just/";
|
||||
flake = false;
|
||||
};
|
||||
"plugin:ltex_extra-nvim" = {
|
||||
url = "github:barreiroleo/ltex_extra.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Plugins that are not in nixpkgs
|
||||
"new-plugin:vim-headerguard" = {
|
||||
"vim-headerguard" = {
|
||||
url = "github:drmikehenry/vim-headerguard";
|
||||
flake = false;
|
||||
};
|
||||
|
|
@ -333,7 +137,7 @@
|
|||
naersk' = inputs.naersk.lib.${system};
|
||||
pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) ["warcraftlogs"];
|
||||
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "warcraftlogs" ];
|
||||
};
|
||||
};
|
||||
packages =
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
upstream,
|
||||
vimPlugins,
|
||||
neovimUtils,
|
||||
nurl,
|
||||
python3,
|
||||
wrapNeovimUnstable,
|
||||
stdenv,
|
||||
makeWrapper,
|
||||
}:
|
||||
let
|
||||
neovimTs = (neovimUtils.override { neovim-unwrapped = upstream; }).makeNeovimConfig {
|
||||
plugins = [ vimPlugins.nvim-treesitter ];
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "update-nvim-treesitter";
|
||||
src = ./update.py;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cat $src > $out/bin/update-nvim-treesitter
|
||||
chmod +x $out/bin/update-nvim-treesitter
|
||||
wrapProgram $out/bin/update-nvim-treesitter --set NVIM_TREESITTER "${vimPlugins.nvim-treesitter}" --prefix PATH : ${
|
||||
lib.makeBinPath [
|
||||
(wrapNeovimUnstable upstream neovimTs)
|
||||
nurl
|
||||
python3
|
||||
]
|
||||
}
|
||||
'';
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,97 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
callPackage,
|
||||
tree-sitter,
|
||||
neovim,
|
||||
neovimUtils,
|
||||
runCommand,
|
||||
}:
|
||||
self: super:
|
||||
let
|
||||
inherit (neovimUtils) grammarToPlugin;
|
||||
generatedGrammars = callPackage ./generated.nix { inherit (tree-sitter) buildGrammar; };
|
||||
|
||||
generatedDerivations = lib.filterAttrs (_: lib.isDerivation) generatedGrammars;
|
||||
|
||||
# add aliases so grammars from `tree-sitter` are overwritten in `withPlugins`
|
||||
# for example, for ocaml_interface, the following aliases will be added
|
||||
# ocaml-interface
|
||||
# tree-sitter-ocaml-interface
|
||||
# tree-sitter-ocaml_interface
|
||||
builtGrammars =
|
||||
generatedGrammars
|
||||
// lib.concatMapAttrs (
|
||||
k: v:
|
||||
let
|
||||
replaced = lib.replaceStrings [ "_" ] [ "-" ] k;
|
||||
in
|
||||
{
|
||||
"tree-sitter-${k}" = v;
|
||||
}
|
||||
// lib.optionalAttrs (k != replaced) {
|
||||
${replaced} = v;
|
||||
"tree-sitter-${replaced}" = v;
|
||||
}
|
||||
) generatedDerivations;
|
||||
|
||||
allGrammars = lib.attrValues generatedDerivations;
|
||||
|
||||
# Usage:
|
||||
# pkgs.vimPlugins.nvim-treesitter.withPlugins (p: [ p.c p.java ... ])
|
||||
# or for all grammars:
|
||||
# pkgs.vimPlugins.nvim-treesitter.withAllGrammars
|
||||
withPlugins =
|
||||
f:
|
||||
self.nvim-treesitter.overrideAttrs {
|
||||
passthru.dependencies = map grammarToPlugin (f (tree-sitter.builtGrammars // builtGrammars));
|
||||
};
|
||||
|
||||
withAllGrammars = withPlugins (_: allGrammars);
|
||||
in
|
||||
{
|
||||
postPatch = ''
|
||||
rm -r parser
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit
|
||||
builtGrammars
|
||||
allGrammars
|
||||
grammarToPlugin
|
||||
withPlugins
|
||||
withAllGrammars
|
||||
;
|
||||
|
||||
grammarPlugins = lib.mapAttrs (_: grammarToPlugin) generatedDerivations;
|
||||
|
||||
tests.check-queries =
|
||||
let
|
||||
nvimWithAllGrammars = neovim.override { configure.packages.all.start = [ withAllGrammars ]; };
|
||||
in
|
||||
runCommand "nvim-treesitter-check-queries"
|
||||
{
|
||||
nativeBuildInputs = [ nvimWithAllGrammars ];
|
||||
CI = true;
|
||||
}
|
||||
''
|
||||
touch $out
|
||||
export HOME=$(mktemp -d)
|
||||
ln -s ${withAllGrammars}/CONTRIBUTING.md .
|
||||
|
||||
nvim --headless "+luafile ${withAllGrammars}/scripts/check-queries.lua" | tee log
|
||||
|
||||
if grep -q Warning log; then
|
||||
echo "Error: warnings were emitted by the check"
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
meta =
|
||||
with lib;
|
||||
(super.nvim-treesitter.meta or { })
|
||||
// {
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ figsoda ];
|
||||
};
|
||||
}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import subprocess
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from os import environ
|
||||
from os.path import dirname, join
|
||||
import sys
|
||||
|
||||
lockfile = json.load(open(join(environ["NVIM_TREESITTER"], "lockfile.json")))
|
||||
|
||||
configs = json.loads(
|
||||
subprocess.check_output(
|
||||
[
|
||||
"nvim",
|
||||
"--headless",
|
||||
"-u",
|
||||
"NONE",
|
||||
"+lua io.write(vim.json.encode(require('nvim-treesitter.parsers').get_parser_configs()))",
|
||||
"+quit!",
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def generate_grammar(item):
|
||||
lang, lock = item
|
||||
cfg = configs.get(lang)
|
||||
if not cfg:
|
||||
return ""
|
||||
|
||||
info = cfg["install_info"]
|
||||
url = info["url"]
|
||||
rev = lock["revision"]
|
||||
|
||||
generated = f""" {lang} = buildGrammar {{
|
||||
language = "{lang}";
|
||||
version = "0.0.0+rev={rev[:7]}";
|
||||
src = """
|
||||
|
||||
generated += subprocess.check_output(["nurl", url, rev, "--indent=4"], text=True)
|
||||
generated += ";"
|
||||
|
||||
location = info.get("location")
|
||||
if location:
|
||||
generated += f"""
|
||||
location = "{location}";"""
|
||||
|
||||
if info.get("requires_generate_from_grammar"):
|
||||
generated += """
|
||||
generate = true;"""
|
||||
|
||||
generated += f"""
|
||||
meta.homepage = "{url}";
|
||||
}};
|
||||
"""
|
||||
|
||||
return generated
|
||||
|
||||
|
||||
generated_file = """# generated by nix run .\#update-nvim-treesitter -- nvim-treesitter
|
||||
|
||||
{ buildGrammar, """
|
||||
|
||||
generated_file += subprocess.check_output(["nurl", "-Ls", ", "], text=True)
|
||||
|
||||
generated_file += """ }:
|
||||
|
||||
{
|
||||
"""
|
||||
|
||||
for generated in ThreadPoolExecutor().map(generate_grammar, lockfile.items()):
|
||||
generated_file += generated
|
||||
|
||||
generated_file += "}\n"
|
||||
|
||||
open(join(sys.argv[1], "generated.nix"), "w").write(generated_file)
|
||||
|
|
@ -1,19 +1,4 @@
|
|||
{
|
||||
inputs,
|
||||
lib,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inputsMatching =
|
||||
prefix:
|
||||
lib.mapAttrs' (prefixedName: value: {
|
||||
name =
|
||||
builtins.substring (builtins.stringLength "${prefix}:") (builtins.stringLength prefixedName)
|
||||
prefixedName;
|
||||
inherit value;
|
||||
}) (lib.filterAttrs (name: _: (builtins.match "${prefix}:.*" name) != null) inputs);
|
||||
in
|
||||
{ inputs, self, ... }:
|
||||
{
|
||||
perSystem =
|
||||
{
|
||||
|
|
@ -24,52 +9,31 @@ in
|
|||
...
|
||||
}:
|
||||
{
|
||||
packages =
|
||||
let
|
||||
neovimPlugins =
|
||||
packages = {
|
||||
neovimTraxys = inputs'.nixvim.legacyPackages.makeNixvimWithModule {
|
||||
module = {
|
||||
imports = [ ./default.nix ];
|
||||
};
|
||||
extraSpecialArgs = {
|
||||
flake = self;
|
||||
};
|
||||
pkgs = pkgs.extend (
|
||||
final: prev:
|
||||
{
|
||||
vimPlugins = prev.vimPlugins.extend (
|
||||
final': prev':
|
||||
(lib.mapAttrs (
|
||||
pname: src:
|
||||
prev'."${pname}".overrideAttrs (old: {
|
||||
version = src.shortRev;
|
||||
inherit src;
|
||||
})
|
||||
) (inputsMatching "plugin"))
|
||||
// (lib.mapAttrs (
|
||||
pname: src:
|
||||
prev.vimUtils.buildVimPlugin {
|
||||
inherit pname src;
|
||||
version = src.shortRev;
|
||||
}
|
||||
) (inputsMatching "new-plugin"))
|
||||
// {
|
||||
nvim-treesitter = prev'.nvim-treesitter.overrideAttrs (
|
||||
prev.callPackage ./nvim-treesitter/override.nix { } final' prev'
|
||||
);
|
||||
final': prev': {
|
||||
vim-headerguard = prev.vimUtils.buildVimPlugin {
|
||||
pname = "vim-headerguard";
|
||||
src = inputs.vim-headerguard;
|
||||
version = inputs.vim-headerguard.shortRev;
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
// self'.packages;
|
||||
neovimPkgs = pkgs.extend neovimPlugins;
|
||||
in
|
||||
{
|
||||
neovimTraxys = inputs'.nixvim.legacyPackages.makeNixvimWithModule {
|
||||
module = {
|
||||
imports = [ ./default.nix ];
|
||||
package = inputs'.neovim-flake.packages.neovim;
|
||||
};
|
||||
extraSpecialArgs = {
|
||||
flake = self;
|
||||
};
|
||||
pkgs = neovimPkgs;
|
||||
};
|
||||
update-nvim-treesitter = neovimPkgs.callPackage ./nvim-treesitter {
|
||||
upstream = inputs'.neovim-flake.packages.neovim;
|
||||
};
|
||||
// self'.packages
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
checks.launch = inputs.nixvim.lib.${system}.check.mkTestDerivationFromNvim {
|
||||
nvim = self'.packages.neovimTraxys;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue