updates
This commit is contained in:
parent
2dd66af692
commit
b9c6070a6a
2 changed files with 19 additions and 47 deletions
52
flake.nix
52
flake.nix
|
@ -78,42 +78,16 @@
|
||||||
neovim =
|
neovim =
|
||||||
(pkgs.wrapNeovimUnstable
|
(pkgs.wrapNeovimUnstable
|
||||||
pkgs.neovim-unwrapped
|
pkgs.neovim-unwrapped
|
||||||
(pkgs.neovimUtils.makeNeovimConfig
|
(pkgs.neovimUtils.makeNeovimConfig {
|
||||||
{
|
withPython3 = false;
|
||||||
withPython3 = false;
|
customRC = ''
|
||||||
customRC = ''
|
lua IS_NIX=true
|
||||||
lua ${nvimPluginPaths}
|
lua ${nvimPluginPaths}
|
||||||
lua ${nvimConfigStorePath}
|
lua ${nvimConfigStorePath}
|
||||||
luafile ${./.}/init.lua
|
luafile ${./.}/init.lua
|
||||||
set runtimepath^=${builtins.concatStringsSep "," treesitterParsers}
|
set runtimepath^=${builtins.concatStringsSep "," treesitterParsers}
|
||||||
'';
|
'';
|
||||||
# lua package.path = package.path .. ";${./.}/lua/?.lua"
|
})
|
||||||
# lua print("HELLO WORLD 123! TEST")
|
|
||||||
# lua print("${./.}")
|
|
||||||
# -- lua package.runtimepath = "${./.}`
|
|
||||||
# plugins = [
|
|
||||||
# pkgs.vimPlugins.nvim-treesitter.withAllGrammars
|
|
||||||
# ];
|
|
||||||
# customRC = import ./lua { inherit lib self; };
|
|
||||||
# wrapperArgs = [
|
|
||||||
# # Add runtime dependencies to neovim path
|
|
||||||
# "--prefix"
|
|
||||||
# "PATH"
|
|
||||||
# ":"
|
|
||||||
# "${lib.makeBinPath runtimeDependencies}"
|
|
||||||
# # Set the LAZY env path to the nix store
|
|
||||||
# "--set"
|
|
||||||
# "LAZY"
|
|
||||||
# "${inputs.nvim_plugin-folke/lazy.nvim}"
|
|
||||||
# # Use custom XDG_CONFIG_HOME so it doesn't use the user's real one
|
|
||||||
# # TODO do I need to set all the XDG_ env vars? - or should I remove this entirely?
|
|
||||||
# "--set"
|
|
||||||
# "XDG_CONFIG_HOME"
|
|
||||||
# "${./.}"
|
|
||||||
# ];
|
|
||||||
}
|
|
||||||
|
|
||||||
)
|
|
||||||
).overrideAttrs
|
).overrideAttrs
|
||||||
(old: {
|
(old: {
|
||||||
generatedWrapperArgs = old.generatedWrapperArgs or [ ] ++ [
|
generatedWrapperArgs = old.generatedWrapperArgs or [ ] ++ [
|
||||||
|
@ -122,12 +96,12 @@
|
||||||
"PATH"
|
"PATH"
|
||||||
":"
|
":"
|
||||||
"${lib.makeBinPath runtimeDependencies}"
|
"${lib.makeBinPath runtimeDependencies}"
|
||||||
# Set the LAZY env path to the nix store
|
# Set the LAZY env path to the nix store, see init.lua for how it is used
|
||||||
"--set"
|
"--set"
|
||||||
"LAZY"
|
"LAZY"
|
||||||
"${inputs."nvim_plugin-folke/lazy.nvim"}"
|
"${inputs."nvim_plugin-folke/lazy.nvim"}"
|
||||||
# Use custom XDG_CONFIG_HOME so it doesn't use the user's real one
|
# Don't use default directories to not collide with another neovim config
|
||||||
# TODO do I need to set all the XDG_ env vars? - or should I remove this entirely?
|
# All things at runtime should be deletable since we are using nix to handle downloads and bins.
|
||||||
"--set"
|
"--set"
|
||||||
"XDG_CONFIG_HOME"
|
"XDG_CONFIG_HOME"
|
||||||
"/tmp/nvim_flaked/config"
|
"/tmp/nvim_flaked/config"
|
||||||
|
|
14
init.lua
14
init.lua
|
@ -1,4 +1,6 @@
|
||||||
if NVIM_CONFIG_STORE_PATH then
|
print("LOADING... is nix: " .. vim.inspect(IS_NIX))
|
||||||
|
|
||||||
|
if IS_NIX then
|
||||||
-- Add my lua dir to the path. THIS IS NOT RECURSIVE!
|
-- Add my lua dir to the path. THIS IS NOT RECURSIVE!
|
||||||
-- For recursive we can do something like this: https://github.com/RingOfStorms/nvim/blob/0b833d555c69e88b450a10eec4e39a782bad1037/init.lua#L1-L17
|
-- For recursive we can do something like this: https://github.com/RingOfStorms/nvim/blob/0b833d555c69e88b450a10eec4e39a782bad1037/init.lua#L1-L17
|
||||||
-- However this pollutes the path, it oculd be limited to just init files but this approach here one level deep is adequate for my own needs
|
-- However this pollutes the path, it oculd be limited to just init files but this approach here one level deep is adequate for my own needs
|
||||||
|
@ -12,8 +14,8 @@ require("keymaps")
|
||||||
-- When using nix, it will set lazy via LAZY env variable.
|
-- When using nix, it will set lazy via LAZY env variable.
|
||||||
local lazypath = vim.env.LAZY or (vim.fn.stdpath("data") .. "/lazy/lazy.nvim")
|
local lazypath = vim.env.LAZY or (vim.fn.stdpath("data") .. "/lazy/lazy.nvim")
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
if vim.env.LAZY then
|
if IS_NIX then
|
||||||
error("LAZY environment variable provided but it does not exist at path: " .. vim.env.LAZY)
|
error("LAZY environment variable to nix store was not found: " .. vim.env.LAZY)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- For non nix systems, pull lazy stable to the normal XDG config path
|
-- For non nix systems, pull lazy stable to the normal XDG config path
|
||||||
|
@ -31,13 +33,9 @@ if not vim.loop.fs_stat(lazypath) then
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
print("TEST")
|
|
||||||
-- local asd = require("plugins")
|
|
||||||
-- print("TEST2 " .. vim.inspect(asd))
|
|
||||||
|
|
||||||
-- Setup lazy
|
-- Setup lazy
|
||||||
function getSpec()
|
function getSpec()
|
||||||
if NVIM_CONFIG_STORE_PATH then
|
if IS_NIX then
|
||||||
local plugins = {}
|
local plugins = {}
|
||||||
local plugins_path = debug.getinfo(2, "S").source:sub(2):match("(.*/)") .. "lua/plugins"
|
local plugins_path = debug.getinfo(2, "S").source:sub(2):match("(.*/)") .. "lua/plugins"
|
||||||
for _, file in ipairs(vim.fn.readdir(plugins_path, [[v:val =~ '\.lua$']])) do
|
for _, file in ipairs(vim.fn.readdir(plugins_path, [[v:val =~ '\.lua$']])) do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue