Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

home-manager: Reading a neovim config from the relative path instead happens in /nix/store #72

Closed
rteats opened this issue Apr 30, 2024 · 3 comments

Comments

@rteats
Copy link

rteats commented Apr 30, 2024

I have the following lines in my home-manager/home.nix:

programs.neovim = {
    enable = true;
    defaultEditor = true;
    extraLuaConfig = lib.fileContents ./nvim/init.lua; 
    ...
};

The extraLuaConfig part is taken from Neovim NixOS wiki, and is expected to read the neovim config I have as a git submodule in home-manager/nvim/init.lua. But, it instead looks for it in /nix/store.

The error in the output of the switch command:

error: getting status of '/nix/store/16ch7mkx4ybbjrxnalknyks8d4mzsahb-source/home-manager/nvim': No such file or directory

git status output:

~/nix-config/ > git status
On branch main
Your branch is ahead of 'origin/main' by 1 commit.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

Is there a way to read the config file from home-manager/nvim/init.lua and not from /nix/store?

@Misterio77
Copy link
Owner

Misterio77 commented Apr 30, 2024

Hey @rteats,

Flakes (so, the entire repo) are copied to the nix store before evaluation happens, so any relative paths are actually relative to the flake copy existing in the store (in that particular evaluation, /nix/store/16ch7mkx4ybbjrxnalknyks8d4mzsahb-source), this is by design.

The actual issue, though, is that submodules are not copied by default, there's a few workarounds for that: NixOS/nix#6633

@Misterio77
Copy link
Owner

Misterio77 commented Apr 30, 2024

Overall, I don't recommend using submodules, you might want to add your neovim config repo as a non-flake input, perhaps? You can fetch any repository this way, it being a flake or not. Another alternative would be to simply fetch your other repo with fetchFromGitHub and friends.

@rteats
Copy link
Author

rteats commented May 2, 2024

Hi, thanks for the fast reply.

submodules are not copied by default

That was the information I didn't know, and the solution for me was to use .?submodules=1#username@hostname on rebuild. As of to use submodules or not, thanks for pointing the alternatives out, I'm sure I'll find use for them soon. :)

Thanks for creating these beautiful configs, by the way. Starting out with the minimal one right now, the experience is great!

@rteats rteats closed this as completed May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants