Skip to content

Commit

Permalink
build(nix): simplify test derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Feb 16, 2024
1 parent 1f1e589 commit 0b350cb
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 54 deletions.
23 changes: 0 additions & 23 deletions nix/init.lua

This file was deleted.

66 changes: 35 additions & 31 deletions nix/plugin-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -160,50 +160,54 @@ in {
neovim-with-rocks = let
neovimConfig = final.neovimUtils.makeNeovimConfig {
withPython3 = true;
viAlias = true;
vimAlias = true;
plugins = with final.vimPlugins; [
rocks-nvim
];
viAlias = false;
vimAlias = false;
};
runtimeDeps = with final; [
lua5_1
luarocks
];
customRC = builtins.readFile ./init.lua;
rocks = lua51Packages.rocks-nvim;
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.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_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}", "lib", "lua", "5.1", "?.so"),
vim.fs.joinpath("${rocks}", "lib64", "lua", "5.1", "?.so"),
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", "*"))
'';
wrapRc = true;
wrapperArgs =
lib.escapeShellArgs neovimConfig.wrapperArgs
+ " "
+ ''--add-flags -u --add-flags "${final.writeText "init.lua" customRC}"''
+ " "
+ ''--set NVIM_APPNAME "nvimrocks"''
+ " "
# XXX: Luarocks packages need to be added manaully,
# using LUA_PATH and LUA_CPATH.
# It looks like buildNeovimPlugin is broken?
+ ''--suffix LUA_CPATH ";" "${
lib.concatMapStringsSep ";" lua51Packages.getLuaCPath
(with lua51Packages; [
toml
toml-edit
fidget-nvim
nvim-nio
fzy
])
}"''
+ " "
+ ''--suffix LUA_PATH ";" "${
lib.concatMapStringsSep ";" lua51Packages.getLuaPath
(with lua51Packages; [
fidget-nvim
nvim-nio
fzy
])
}"''
+ " "
+ ''--prefix PATH : "${lib.makeBinPath runtimeDeps}"'';
});
}

0 comments on commit 0b350cb

Please sign in to comment.