From 05a35aa69f798386b326d902343d8d1f9421dea4 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Wed, 16 Aug 2023 23:45:07 +0200 Subject: [PATCH] feat: add lua-ls to pre-commit-hooks-nix --- CHANGELOG.md | 1 + flake.lock | 266 ++++++++++++++++++++++++++++++++++++++++----- flake.nix | 34 ++++++ nix/ci-overlay.nix | 10 ++ 4 files changed, 282 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f4ff6e..f6b5a54 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - More pre-commit-hooks and linters. - `luarocks-tag-release` workflow. +- Add lua-ls pre-commit checks. ### Changed diff --git a/flake.lock b/flake.lock index 30ee2e8..269e8a3 100755 --- a/flake.lock +++ b/flake.lock @@ -50,13 +50,77 @@ "type": "github" } }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1690933134, + "narHash": "sha256-ab989mN63fQZBFrkk4Q8bYxQCktuHmBIBqUG1jl6/FQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "59cf3f1447cfc75087e7273b04b31e689a8599fb", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1688466019, + "narHash": "sha256-VeM2akYrBYMsb4W/MmBo1zmaMfgbL4cH3Pu8PGyIwJ0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8e8d955c22df93dbe24f19ea04f47a74adbdc5ec", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "flake-parts_4": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly-overlay", + "hercules-ci-effects", + "hercules-ci-agent", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688466019, + "narHash": "sha256-VeM2akYrBYMsb4W/MmBo1zmaMfgbL4cH3Pu8PGyIwJ0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8e8d955c22df93dbe24f19ea04f47a74adbdc5ec", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", "type": "github" }, "original": { @@ -66,12 +130,15 @@ } }, "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", "type": "github" }, "original": { @@ -101,6 +168,80 @@ "type": "github" } }, + "haskell-flake": { + "locked": { + "lastModified": 1684780604, + "narHash": "sha256-2uMZsewmRn7rRtAnnQNw1lj0uZBMh4m6Cs/7dV5YF08=", + "owner": "srid", + "repo": "haskell-flake", + "rev": "74210fa80a49f1b6f67223debdbf1494596ff9f2", + "type": "github" + }, + "original": { + "owner": "srid", + "ref": "0.3.0", + "repo": "haskell-flake", + "type": "github" + } + }, + "hercules-ci-agent": { + "inputs": { + "flake-parts": "flake-parts_4", + "haskell-flake": "haskell-flake", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1688568579, + "narHash": "sha256-ON0M56wtY/TIIGPkXDlJboAmuYwc73Hi8X9iJGtxOhM=", + "owner": "hercules-ci", + "repo": "hercules-ci-agent", + "rev": "367dd8cd649b57009a6502e878005a1e54ad78c5", + "type": "github" + }, + "original": { + "id": "hercules-ci-agent", + "type": "indirect" + } + }, + "hercules-ci-effects": { + "inputs": { + "flake-parts": "flake-parts_3", + "hercules-ci-agent": "hercules-ci-agent", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1689397210, + "narHash": "sha256-fVxZnqxMbsDkB4GzGAs/B41K0wt/e+B/fLxmTFF/S20=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "0a63bfa3f00a3775ea3a6722b247880f1ffe91ce", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, + "neodev-nvim": { + "flake": false, + "locked": { + "lastModified": 1692165937, + "narHash": "sha256-g9jVGPdyaBE+tBSsOSthbw1hJgPy7K/LLGt06AqTFUE=", + "owner": "folke", + "repo": "neodev.nvim", + "rev": "f1f5f840fec7218bd277e7e88e7c539c305f649a", + "type": "github" + }, + "original": { + "owner": "folke", + "repo": "neodev.nvim", + "type": "github" + } + }, "neovim-flake": { "inputs": { "flake-utils": "flake-utils", @@ -111,11 +252,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1680116052, - "narHash": "sha256-vKGyPrW0rLFXzdqFCEcTu6BOvcK5k9MCCzDZvInqxG8=", + "lastModified": 1692141167, + "narHash": "sha256-1My5JBKfHupN9D86eeX8JFr2Wk03qWJObk73NC1/x2s=", "owner": "neovim", "repo": "neovim", - "rev": "8b7fb668e440f7793564b764bc9a691e3f45382a", + "rev": "f92bda1dad462de81ec92134dfa9ba637edc7bb7", "type": "github" }, "original": { @@ -128,17 +269,19 @@ "neovim-nightly-overlay": { "inputs": { "flake-compat": "flake-compat", + "flake-parts": "flake-parts_2", + "hercules-ci-effects": "hercules-ci-effects", "neovim-flake": "neovim-flake", "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1680164063, - "narHash": "sha256-p9+J62tnpOsV9VG1STscjvmas7vOhIpaWpGUsWYMOhY=", + "lastModified": 1692144319, + "narHash": "sha256-sJ7KT+dfLEQbsNI2G+ZLKQ0tIS72roMv+xjC+0bTS9k=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "c0aefdc143d934284e85f51dbcbc2ee589dd4758", + "rev": "3632032784ed4a7f761a61a3337f2e1d61210eae", "type": "github" }, "original": { @@ -149,16 +292,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1680182246, - "narHash": "sha256-2WEHGApYCVt7bCm/0Ws8qYnp5Jn0mRgZ91tkoN+HrcY=", - "owner": "nixos", + "lastModified": 1688322751, + "narHash": "sha256-eW62dC5f33oKZL7VWlomttbUnOTHrAbte9yNUNW8rbk=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "b7fc729117a70d0df9e9adfc624662148e32ca0a", + "rev": "0fbe93c5a7cac99f90b60bdf5f149383daaa615f", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", + "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -181,18 +324,52 @@ "type": "github" } }, + "nixpkgs-lib_2": { + "locked": { + "dir": "lib", + "lastModified": 1688049487, + "narHash": "sha256-100g4iaKC9MalDjUW9iN6Jl/OocTDtXdeAj7pEGIRh4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4bc72cae107788bf3f24f30db2e2f685c9298dc9", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { - "lastModified": 1678872516, - "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-22.11", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1692190437, + "narHash": "sha256-yJUZzmzSmDYb9ONPnMQDru66RjZgGQZRvj3tQebkexk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9b2aa98db6b10503666a50f4eb93b2fc0d57bde5", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } @@ -200,11 +377,11 @@ "plenary-nvim": { "flake": false, "locked": { - "lastModified": 1676797549, - "narHash": "sha256-z5JHuQcF1EvySnRBywl6EOrp8aRO0nd2dnkXJg2ge58=", + "lastModified": 1689589150, + "narHash": "sha256-oRtNcURQzrIRS3D88tWAl3HuFHxVJr8m/zzL7xoa/II=", "owner": "nvim-lua", "repo": "plenary.nvim", - "rev": "253d34830709d690f013daf2853a9d21ad7accab", + "rev": "267282a9ce242bbb0c5dc31445b6d353bed978bb", "type": "github" }, "original": { @@ -224,11 +401,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1680170909, - "narHash": "sha256-FtKU/edv1jFRr/KwUxWTYWXEyj9g8GBrHntC2o8oFI8=", + "lastModified": 1692203373, + "narHash": "sha256-St6Ie93YMi8ugwnbIFLuse7KE9f7nwmwT+fo86Mk/8Y=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "29dbe1efaa91c3a415d8b45d62d48325a4748816", + "rev": "3e3d45c1f26e212abe24188ece996871d94618d8", "type": "github" }, "original": { @@ -240,11 +417,42 @@ "root": { "inputs": { "flake-parts": "flake-parts", + "neodev-nvim": "neodev-nvim", "neovim-nightly-overlay": "neovim-nightly-overlay", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "plenary-nvim": "plenary-nvim", "pre-commit-hooks": "pre-commit-hooks" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index ca9821e..18a59f3 100755 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + neodev-nvim = { + url = "github:folke/neodev.nvim"; + flake = false; + }; + plenary-nvim = { url = "github:nvim-lua/plenary.nvim"; flake = false; @@ -28,6 +33,7 @@ flake-parts, pre-commit-hooks, neovim-nightly-overlay, + neodev-nvim, plenary-nvim, ... }: let @@ -53,6 +59,7 @@ ci-overlay = import ./nix/ci-overlay.nix { inherit self + neodev-nvim plenary-nvim ; }; @@ -72,9 +79,36 @@ alejandra.enable = true; stylua.enable = true; luacheck.enable = true; + lua-ls.enable = true; editorconfig-checker.enable = true; markdownlint.enable = true; }; + settings = { + lua-ls = { + config = { + runtime.version = "LuaJIT"; + Lua = { + workspace = { + library = [ + "${pkgs.neovim-nightly}/share/nvim/runtime/lua" + "${pkgs.neodev-plugin}/types/nightly" + "${pkgs.plenary-plugin}/lua" + ]; + checkThirdParty = false; + ignoreDir = [ + ".git" + ".github" + ".direnv" + "result" + "nix" + "doc" + ]; + }; + diagnostics.libraryFiles = "Disable"; + }; + }; + }; + }; }; devShell = pkgs.mkShell { diff --git a/nix/ci-overlay.nix b/nix/ci-overlay.nix index b1011a1..ed83292 100755 --- a/nix/ci-overlay.nix +++ b/nix/ci-overlay.nix @@ -1,12 +1,18 @@ # Add flake.nix test inputs as arguments here { self, + neodev-nvim, plenary-nvim, }: final: prev: with final.lib; with final.stdenv; let nvim-nightly = final.neovim-nightly; + neodev-plugin = final.pkgs.vimUtils.buildVimPluginFrom2Nix { + name = "neodev.nvim"; + src = neodev-nvim; + }; + plenary-plugin = final.pkgs.vimUtils.buildVimPluginFrom2Nix { name = "plenary.nvim"; src = plenary-nvim; @@ -72,4 +78,8 @@ in { name = "neovim-nightly-tests"; nvim = nvim-nightly; }; + inherit + neodev-plugin + plenary-plugin + ; }