Skip to content

Commit

Permalink
build: add neovim-with-rocks package
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Aug 6, 2024
1 parent e909bb4 commit abb082e
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 4 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@
packages = rec {
default = rocks-edit-nvim;
inherit (pkgs.luajitPackages) rocks-edit-nvim;
inherit (pkgs) docgen;
inherit
(pkgs)
docgen
neovim-with-rocks
;
};

checks = {
Expand Down
53 changes: 53 additions & 0 deletions nix/plugin-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,63 @@
src = self;
version = "dev";
};

neovim-with-rocks = let
rocks = inputs.rocks-nvim-flake.packages.${final.system}.rocks-nvim;
rocks-edit = final.luajitPackages.rocks-edit-nvim;
neovimConfig = final.neovimUtils.makeNeovimConfig {
withPython3 = true;
viAlias = false;
vimAlias = false;
# plugins = [ final.vimPlugins.rocks-nvim ];
extraLuaPackages = _: [rocks];
};
in
final.wrapNeovimUnstable final.neovim-nightly (neovimConfig
// {
luaRcContent =
/*
lua
*/
''
-- Copied from installer.lua
local rocks_config = {
rocks_path = vim.fn.stdpath("data") .. "/rocks",
luarocks_binary = "${final.luajitPackages.luarocks}/bin/luarocks",
}
vim.g.rocks_nvim = rocks_config
local luarocks_path = {
vim.fs.joinpath("${rocks}", "share", "lua", "5.1", "?.lua"),
vim.fs.joinpath("${rocks}", "share", "lua", "5.1", "?", "init.lua"),
vim.fs.joinpath("${rocks-edit}", "share", "lua", "5.1", "?.lua"),
vim.fs.joinpath("${rocks-edit}", "share", "lua", "5.1", "?", "init.lua"),
vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?.lua"),
vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?", "init.lua"),
}
package.path = package.path .. ";" .. table.concat(luarocks_path, ";")
local luarocks_cpath = {
vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.so"),
vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.so"),
}
package.cpath = package.cpath .. ";" .. table.concat(luarocks_cpath, ";")
vim.opt.runtimepath:append(vim.fs.joinpath("${rocks}", "rocks.nvim-scm-1-rocks", "rocks.nvim", "*"))
vim.opt.runtimepath:append(vim.fs.joinpath("${rocks-edit}", "rocks-edit.nvim-scm-1-rocks", "rocks-edit.nvim", "*"))
'';
wrapRc = true;
wrapperArgs =
final.lib.escapeShellArgs neovimConfig.wrapperArgs
+ " "
+ ''--set NVIM_APPNAME "nvimrocks"'';
});
in {
inherit
luajit
luajitPackages
neovim-with-rocks
;

vimPlugins =
Expand Down

0 comments on commit abb082e

Please sign in to comment.