Compare commits

..

No commits in common. "409f726d4aee9212aab0dec44f0fabecc2c46536" and "e4a989664303d812eb4d18a98cd1ebf44e29463e" have entirely different histories.

5 changed files with 26 additions and 148 deletions

1
.envrc
View file

@ -1 +0,0 @@
use flake .# -Lv

3
.gitignore vendored
View file

@ -1,3 +1,2 @@
.luarc.json
result-*
.direnv
result/

View file

@ -9,6 +9,8 @@ It provides a `mk-luarc-json` function,
which takes an attrset with the following arguments:
- `nvim`: The neovim package. Defaults to `neovim-unwrapped`.
- `neodev-types`: neodev.nvim types to add to the `workspace.library`.
Defaults to `"stable"`.
- `plugins`: List of Neovim plugins and/or luarocks packages.
Defaults to an empty list.
- `lua-version`: Defaults to `"5.1"`.

View file

@ -1,31 +1,15 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1717285511,
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
"lastModified": 1706830856,
"narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
"rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f",
"type": "github"
},
"original": {
@ -34,73 +18,13 @@
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1723803910,
"narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"luvit-meta": {
"flake": false,
"locked": {
"lastModified": 1705776742,
"narHash": "sha256-zAAptV/oLuLAAsa2zSB/6fxlElk4+jNZd/cPr9oxFig=",
"owner": "Bilal2453",
"repo": "luvit-meta",
"rev": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60",
"type": "github"
},
"original": {
"owner": "Bilal2453",
"repo": "luvit-meta",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1718714799,
"narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=",
"lastModified": 1708475490,
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e",
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
"type": "github"
},
"original": {
@ -112,28 +36,18 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1717284937,
"narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1720386169,
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
"dir": "lib",
"lastModified": 1706550542,
"narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"rev": "97b17f32362e475016f942bbdfda4a4a72a8a652",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-24.05",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -141,8 +55,6 @@
"root": {
"inputs": {
"flake-parts": "flake-parts",
"git-hooks": "git-hooks",
"luvit-meta": "luvit-meta",
"nixpkgs": "nixpkgs"
}
}

View file

@ -4,22 +4,12 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
luvit-meta = {
url = "github:Bilal2453/luvit-meta";
flake = false;
};
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {
self,
nixpkgs,
flake-parts,
luvit-meta,
git-hooks,
}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = [
@ -38,49 +28,28 @@
luarc = pkgs.mk-luarc-json {
plugins = with pkgs.vimPlugins; [telescope-nvim fidget-nvim];
};
git-hooks-check = git-hooks.lib.${system}.run {
src = self;
hooks = {
alejandra.enable = true;
editorconfig-checker.enable = true;
};
};
in {
devShells.default = pkgs.mkShell {
name = "gen-luarc devShell";
buildInputs = self.checks.${system}.git-hooks-check.enabledPackages;
shellHook = ''
ln -fs ${pkgs.luarc-to-json luarc} .luarc.json
'';
};
checks = rec {
default = git-hooks-check;
inherit git-hooks-check;
};
};
flake = {
overlays.default = final: prev: let
inherit (final) lib;
in {
overlays.default = final: prev: {
mk-luarc = {
# list of plugins that have a /lua directory
nvim ? final.neovim-unwrapped,
neodev-types ? "stable",
plugins ? [],
meta ? {
luvit = true;
},
lua-version ? "5.1",
disabled-diagnostics ? [],
globals ? [],
}: let
pluginPackages =
map (x: x.plugin or x)
plugins;
partitions = builtins.partition (plugin:
plugin.vimPlugin
or false
|| plugin.pname or "" == "nvim-treesitter")
pluginPackages;
builtins.hasAttr "vimPlugin" plugin
&& plugin.vimPlugin
|| plugin.pname == "nvim-treesitter")
plugins;
nvim-plugins = partitions.right;
rocks = partitions.wrong;
plugin-luadirs = builtins.map (plugin: "${plugin}/lua") nvim-plugins;
@ -88,24 +57,21 @@
pkg-sharedirs = builtins.map (pkg: "${pkg}/share/lua/${lua-version}") rocks;
in {
runtime.version = "LuaJIT";
runtime.path = ["?/nvim/init.lua" "?/nvim/lua/?.lua"];
Lua = {
globals =
[
"vim"
]
++ globals;
globals = [
"vim"
];
workspace = {
library =
[
"${nvim}/share/nvim/runtime/lua"
"${final.vimPlugins.neodev-nvim}/types/${neodev-types}"
"\${3rd}/busted/library"
"\${3rd}/luassert/library"
]
++ plugin-luadirs
++ pkg-libdirs
++ pkg-sharedirs
++ (lib.optional (meta.luvit or false) "${luvit-meta}/library");
++ pkg-sharedirs;
ignoreDir = [
".git"
".github"