diff --git a/flake.nix b/flake.nix index 305efed..e7864bf 100644 --- a/flake.nix +++ b/flake.nix @@ -130,16 +130,16 @@ # TODO do I need to set all the XDG_ env vars? - or should I remove this entirely? "--set" "XDG_CONFIG_HOME" - "~/.config/nvim_flaked" + "/tmp/nvim_flaked/config" "--set" "XDG_DATA_HOME" - "~/.local/share/nvim_flaked" + "/tmp/nvim_flaked/share" "--set" "XDG_RUNTIME_DIR" - "/tmp/nvim.user/nvim_flaked/xxx" + "/tmp/nvim_flaked/run" "--set" "XDG_STATE_HOME" - "~/.local/state/nvim_flaked" + "/tmp/nvim_flaked/state" ]; }) diff --git a/init.lua b/init.lua index f0114c4..ef900da 100644 --- a/init.lua +++ b/init.lua @@ -1,26 +1,14 @@ if NVIM_CONFIG_STORE_PATH then - -- Function to add subdirectories to package.path - local function add_lua_subdirs_to_path(base_dir) - local scan_dir - scan_dir = function(dir) - package.path = package.path .. ";" .. dir .. "?.lua" - package.path = package.path .. ";" .. dir .. "?/init.lua" - local paths = vim.fn.globpath(dir, '*/', 0, 1) - for _, subdir in ipairs(paths) do - scan_dir(subdir) -- Recursively add subdirectories - end - end - scan_dir(base_dir) - end - -- Call the function with the base directory of your Lua modules - add_lua_subdirs_to_path(NVIM_CONFIG_STORE_PATH .. "/lua/") + -- 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 + -- 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 + package.path = package.path .. ";" .. NVIM_CONFIG_STORE_PATH .. "/lua/?.lua" + package.path = package.path .. ";" .. NVIM_CONFIG_STORE_PATH .. "/lua/?/init.lua" end require("options") require("keymaps") -print("NIX FLAKE NVIM: nvim packages " .. vim.inspect(NVIM_PLUGIN_PATHS)) - -- When using nix, it will set lazy via LAZY env variable. local lazypath = vim.env.LAZY or (vim.fn.stdpath("data") .. "/lazy/lazy.nvim") if not vim.loop.fs_stat(lazypath) then @@ -44,25 +32,32 @@ end vim.opt.rtp:prepend(lazypath) print("TEST") -local asd = require("catppuccin") -print("TEST2 " .. vim.inspect(asd)) +-- local asd = require("plugins") +-- print("TEST2 " .. vim.inspect(asd)) -- Setup lazy +function getSpec() + if NVIM_CONFIG_STORE_PATH then + -- TODO use same strategy as the tools/init.lua to auto import these + return { require("plugins.catppuccin") } + else + -- TODO I want this to work in the nixos version + -- but it is not resolving properly to the nix store. + -- Will revisit at some point, instead we manually pull them + -- in above. + return { { import = "plugins" } } + end +end require("lazy").setup({ - spec = { - { import = "plugins" }, - }, + spec = getSpec(), change_detection = { enabled = false, }, defaults = { -- lazy = true }, - -- install = { - -- colorscheme = { "catppuccin" }, - -- } }) --- vim.cmd("colorscheme catppuccin") +vim.cmd("colorscheme catppuccin") require("tools") require("autocommands") diff --git a/~/.local/state/nvim_flaked/nvim/log b/~/.local/state/nvim_flaked/nvim/log deleted file mode 100644 index f92106a..0000000 --- a/~/.local/state/nvim_flaked/nvim/log +++ /dev/null @@ -1,6 +0,0 @@ -WRN 2024-04-30T01:39:24.865 ?.1519525 server_start:164: Failed to start server: no such file or directory: /tmp/nvim.user/nvim_flaked/xxx/ -WRN 2024-04-30T10:45:55.120 ?.1604443 server_start:164: Failed to start server: no such file or directory: /tmp/nvim.user/nvim_flaked/xxx/ -WRN 2024-04-30T10:51:56.393 ?.1611908 server_start:164: Failed to start server: no such file or directory: /tmp/nvim.user/nvim_flaked/xxx/ -WRN 2024-04-30T10:54:55.143 ?.1619079 server_start:164: Failed to start server: no such file or directory: /tmp/nvim.user/nvim_flaked/xxx/ -WRN 2024-04-30T10:55:21.678 ?.1619181 server_start:164: Failed to start server: no such file or directory: /tmp/nvim.user/nvim_flaked/xxx/ -WRN 2024-04-30T10:55:38.457 ?.1625034 server_start:164: Failed to start server: no such file or directory: /tmp/nvim.user/nvim_flaked/xxx/