Compare commits

...

10 commits

Author SHA1 Message Date
409f726d4a
feat: add workspace files to path 2024-12-09 20:29:53 -08:00
f809919c3c
feat: allow adding custom globals 2024-12-09 20:29:39 -08:00
39eb7cd853
fix: linter 2024-12-09 20:18:54 -08:00
Marc Jakobi
b36b69c4de style: format flake.nix 2024-08-19 22:05:37 +02:00
Marc Jakobi
603878f8b7 build: git-hooks 2024-08-19 22:05:10 +02:00
Marc Jakobi
afd15ca69f
feat: add luvit-meta (#3)
* chore: add .envrc

* feat: add luvit-meta
2024-08-19 19:53:14 +02:00
Marc Jakobi
021e8078e4 feat!: remove neodev libraries 2024-06-21 00:32:10 +02:00
Marc Jakobi
39704e58b5 chore: update flake.lock 2024-05-31 00:36:31 +02:00
Pierrot
6e8912ea4f
fix: attrset plugin declaration normalized (#2)
fix: infinite recursion

refacto: pluginsNormalized -> pluginPackages
2024-03-20 12:24:26 +01:00
Marc Jakobi
6eb62734da fix: check for pname attr 2024-02-23 12:48:35 +01:00
5 changed files with 148 additions and 26 deletions

1
.envrc Normal file
View file

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

3
.gitignore vendored
View file

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

View file

@ -9,8 +9,6 @@ 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,15 +1,31 @@
{
"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": 1706830856,
"narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=",
"lastModified": 1717285511,
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f",
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
"type": "github"
},
"original": {
@ -18,13 +34,73 @@
"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": 1708475490,
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
"lastModified": 1718714799,
"narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
"rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e",
"type": "github"
},
"original": {
@ -36,18 +112,28 @@
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1706550542,
"narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=",
"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=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "97b17f32362e475016f942bbdfda4a4a72a8a652",
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
@ -55,6 +141,8 @@
"root": {
"inputs": {
"flake-parts": "flake-parts",
"git-hooks": "git-hooks",
"luvit-meta": "luvit-meta",
"nixpkgs": "nixpkgs"
}
}

View file

@ -4,12 +4,22 @@
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 = [
@ -28,28 +38,49 @@
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: {
overlays.default = final: prev: let
inherit (final) lib;
in {
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
partitions = builtins.partition (plugin:
builtins.hasAttr "vimPlugin" plugin
&& plugin.vimPlugin
|| plugin.pname == "nvim-treesitter")
pluginPackages =
map (x: x.plugin or x)
plugins;
partitions = builtins.partition (plugin:
plugin.vimPlugin
or false
|| plugin.pname or "" == "nvim-treesitter")
pluginPackages;
nvim-plugins = partitions.right;
rocks = partitions.wrong;
plugin-luadirs = builtins.map (plugin: "${plugin}/lua") nvim-plugins;
@ -57,21 +88,24 @@
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 = [
globals =
[
"vim"
];
]
++ globals;
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;
++ pkg-sharedirs
++ (lib.optional (meta.luvit or false) "${luvit-meta}/library");
ignoreDir = [
".git"
".github"