Closed misumisumi closed 7 months ago
im currently trying home manager on arch and ubuntu lol
do u have some materials on how pull a git repo to certain location via home manager? or do i have to do it via some nix scripts?
If you are using flakes.nix
, you can use nvimdots.url = "github:misumisumi/nvimdots/improve-nixos";
in inputs.
will this keep it self a valid git repo that i can do git push/pull regularly or it will become a read-only symlink from nix store?
for example, i still want to do normal git push/pull in ~/.config/nvim.
will this keep it self a valid git repo that i can do git push/pull regularly or it will become a read-only symlink from nix store?
become a read-only symlink from nix store.
I misunderstood my intentions.
do u have some materials on how pull a git repo to certain location via home manager?
If you want to manage dotfiles on nix but don't want to include nvimdots in /nix/store
, you can probably use home.activation
.
This allows you to define additional scripts to run when home-manager is started.
For example, if .config/nvim
does not exist, the following settings are pulled from the git repo.
{ config
, lib
, pkgs
, ...
}:
{
home.activation.nvimdotsActivatioinAction = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
if [ ! -d ${config.xdg.configHome}/nvim ]; then
${pkgs.git}/bin/git clone https://github.com/ayamir/nvimdots.git ${config.xdg.configHome}/nvim
fi
'';
}
I am very interested in NixOS, but due to the lack of relevant documentation, I have yet to try it. Could you give me some advice or resources?
The following materials may be helpful.
thank you!
While reviewing the source code, I realized that it could be written better.
For example, we are now installing dependencies in the user's environment, which can be replaced with the path from /nix/store
.
Personally, I was very concerned about the fact that environment variables were declared using alias.
Therefore, we have issued a PR that allows you to add build-dependent paths to the home-manager
side.
No more code is needed to resolve dependencies.
(The haskell
part etc. are stil required )
Therefore, I would like to make further changes based on upstream trends. Is that ok?
Since the PR here only added functionality, I will open the PR again to resolve build dependencies.
Hi there, I'm new to nixOS and I'm trying to get this to work with my old config. I'm using flakes and the base of nvimdots is working, but I couldn't find a way to merge my user
configs, right now I've tried to put:
xdg.configFile = {
"nvim/lua/user".source = ./nvim/lua/user;
};
in my home-manager config, but nix complains about Error installing file '.config/nvim/lua/user' outside $HOME
, so I guess this isn't the correct way to do it.
Another issue I've found is that the generated wrapper for nvim
doesn't work with fish shell, with the following error:
- (line 1): The function “nvim” calls itself immediately, which would result in an infinite loop.
function nvim --description 'alias nvim CPATH=/etc/profiles/per-user/j4ger/lib/nvim-depends/include CPLUS_INCLUDE_PATH=/etc/profiles/per-user/j4ger/lib/nvim-depends/include/c++/v1 LD_LIBRARY_PATH=/etc/profiles/per-user/j4ger/lib/nvim-depends/lib LIBRARY_PATH=/etc/profiles/per-user/j4ger/lib/nvim-depends/lib NIX_LD_LIBRARY_PATH=/etc/profiles/per-user/j4ger/lib/nvim-depends/lib PKG_CONFIG_PATH=/etc/profiles/per-user/j4ger/lib/nvim-depends/pkgconfig nvim'; CPATH=/etc/profiles/per-user/j4ger/lib/nvim-depends/include CPLUS_INCLUDE_PATH=/etc/profiles/per-user/j4ger/lib/nvim-depends/include/c++/v1 LD_LIBRARY_PATH=/etc/profiles/per-user/j4ger/lib/nvim-depends/lib LIBRARY_PATH=/etc/profiles/per-user/j4ger/lib/nvim-depends/lib NIX_LD_LIBRARY_PATH=/etc/profiles/per-user/j4ger/lib/nvim-depends/lib PKG_CONFIG_PATH=/etc/profiles/per-user/j4ger/lib/nvim-depends/pkgconfig nvim $argv
But it does work fine under bash tho.
Hi there, I'm new to nixOS and I'm trying to get this to work with my old config. I'm using flakes and the base of nvimdots is working, but I couldn't find a way to merge my user configs, right now I've tried to put:
I forgot that in nix flake, only git managed files are copied to /nix/store
.
An error occurs because lua/user
in this repository is not managed by git.
To resolve this, you need to fork to your own repository and add lua/user
.
Another issue I've found is that the generated wrapper for nvim doesn't work with fish shell, with the following error:
Is this due to differences in the syntax of adding environment variables between bash or zsh and fish? The current alias settings have only been confirmed to work with bash and zsh.
We will need to adjust your options a bit for both issues. Especially for the latter, it seems necessary to write settings suitable for the shell.
I forgot that in nix flake, only git managed files are copied to
/nix/store
. An error occurs becauselua/user
in this repository is not managed by git. To resolve this, you need to fork to your own repository and addlua/user
.
I see. Perhaps an option allowing user specific config directory to be passed in would be nice (I'm new to flakes, is it achievable?), or is it possible to model every possible config entries exposed by nvimdots (sounds like a lot of work)?
Is this due to differences in the syntax of adding environment variables between bash or zsh and fish? The current alias settings have only been confirmed to work with bash and zsh.
I tested this on both stable and 23.11 branch of the official neovim package in nixpkgs and none of them worked, so I believe this is an upstream issue. Curious though as I couldn't find any report on this, maybe it's due to my setup? I'll try to investigate that wrapper script later tomorrow.
Perhaps an option allowing user specific config directory to be passed in would be nice (I'm new to flakes, is it achievable?), or is it possible to model every possible config entries exposed by nvimdots (sounds like a lot of work)?
Placing user directories is easy with home-manager. In that case, you need to specify the relative path in your repository instead of the path to this repository.
I tested this on both stable and 23.11 branch of the official neovim package in nixpkgs and none of them worked, so I believe this is an upstream issue
Does this mean that the environment variables (PATH etc.) set in the wrapped neovim cannot be used in the first place? is,
makeWrapper
is the wrapping script.
I don't use fish so I don't know if this is a widespread problem.
Placing user directories is easy with home-manager. In that case, you need to specify the relative path in your repository instead of the path to this repository.
I see, thanks for the explanation! I'll give it a try later.
Does this mean that the environment variables (PATH etc.) set in the wrapped neovim cannot be used in the first place? is,
makeWrapper
is the wrapping script. I don't use fish so I don't know if this is a widespread problem.
It turns out that there's a wrapper function (different from the wrapper script) defined for fish (I couldn't find out where is was defined, at least not in the source flake of neovim, or is it hidden in one of the nix functions?) that explicitly calls nvim
, which should be command nvim
, as stated in fish documentation:
If the alias has the same name as the aliased command, you need to prefix the call to the program with
command
to tell fish that the function should not call itself, but rather a command with the same name. If you forget to do so, the function would call itself until the end of time. Usually fish is smart enough to figure this out and will refrain from doing so (which is hopefully in your interest).
I'm not sure how to fix this because I couldn't locate the source of this wrapper function. Right now I'll use neovide to launch it I guess.
I am using. It is possible to add settings for nixd I'm planning to include a development environment to make it easier to check the operation of the nix environment, but I'm busy so I don't know when that will happen. I'm going to do it as soon as possible.
Hi, @misumisumi
I'm new to nix, so i might have some dumb question lol
I recently bump into some issues with mason.nvim
when using nix on macOS, hope u might have insight on how to find resources to fix those issues.
When ran :checkhealth
, mason.nvim
doesn't seem to able to find some of the pkgs installed via nix/home-manager
, here's the screenshot:
When I call :Mason
, it seems it failed to connect to github:
Mason.log
[ERROR Thu Apr 25 11:39:27 2024] ...te/lazy/mason.nvim/lua/mason-registry/sources/github.lua:146: Failed to install registry GitHubRegistrySource(repo=mason-org/mason-registry). "vim/_editor.lua:0: E5560: Vimscript function must not be called in a lua loop callback"
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"clang-format\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"eslint_d\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"jq\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"markdownlint\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"prettier\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"shfmt\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"stylua\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"nixpkgs-fmt\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"bash-language-server\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"docker-compose-language-service\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"dockerfile-language-server\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"json-lsp\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"lua-language-server\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"marksman\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"python-lsp-server\"".
[ERROR Thu Apr 25 11:39:27 2024] ...re/nvim/site/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"taplo\"".
This doesn't seem to be the issue on Ubuntu w/ nix
, I can use mason
in nvim
normally.
Also, here's my nix/home-manager config: https://github.com/CharlesChiuGit/nix-hm-config
btw, i want to use the nvim-nightly version, so it seems that i cant use home-manager's option to config it like u do?
Is this happens to do with some nix config I need to change?
Also I found this plugin: https://github.com/b-src/lazy-nix-helper.nvim
Do I need to include this plugin if I want to use nix on other platform than NixOS
?
I don't have a Mac environment, so I don't know the cause. I'll do some testing on the weekend. Is your Mac an ARM?
Also I found this plugin: https://github.com/b-src/lazy-nix-helper.nvim
Apparently this just disables mason.nvim
in NixOS.
In this implementation, since we want to use the ecosystem related to mason.nvim
(mason-lspconfig.nvim
, etc.), LSP and formatter are built with mason.nvim
(although this is against the Nix philosophy).
Also, if other plugins also require building, they may not be built correctly in a nix
environment.
Is your Mac an ARM?
ys, i'm using m1
I'll do some testing on the weekend.
appreciate that!
although this is against the Nix philosophy
ys, i do notice your PR in home-manager lmao https://github.com/nix-community/home-manager/pull/5225
i think my final goal is:
~/.config/nvim
as a normal git repo that i can do git commands.currently i can do 1. & 3., but have no clue how to do 2. 🤣
use home-manager options to config nvim env in nix, or any other nix methods that can build up a functional nvim env.
home-manager has an option to configure neovim, so I think you can use that. It provides options to bundle python and lua packages with neovim, and options to configure .config and below. You don't need to use the latter, so 1. and 3. are satisfied.
I did tried it before, but i think home-manager option only supports nvim stable but nightly? or did i miss anything that can let me set it to nightly in https://github.com/nix-community/home-manager/blob/master/modules/programs/neovim.nix ?
Need add programs.neovim.package = pkgs.neovim-nightly; in home-manager.
tks! after try and error, i finally got it working! for those who might be interested: https://github.com/CharlesChiuGit/nix-hm-config/blob/a0842603ed9beecab652ac34caa0f8c1ccaa49c5/home.nix#L153-L188
$ nvim --version
NVIM v0.10.0-dev-a736e84
Build type: Release
LuaJIT 2.1.1693350652
Run "nvim -V1 -v" for more info
i'm not sure why luarocks
doesn't got detected tho, it should be installed.
i'm not sure why luarocks doesn't got detected tho, it should be installed.
extraLuaPackages is probably where you define packages that are used internally, such as python modules. Check and submit a PR.
ys i do place luarocks in extraLuapackages that's why i'm confused lol
Feature description
I'm glad to have contributed to the support for NixOS last time. Since then, we have been able to operate it stably for several months. However, previous support did not provide an option to place
lazy-lock.json
under.config/nvim
. This is because NixOS places it as read-only, which means it cannot be updated with:Lazy
. Fortunately, we were able to create a workflow that updateslazy-lock.json
by following upstream in a forked repository based onupdate_lockfile.yml
, so the above problem will be alleviated. I provide bind support in terms of the NixOS ethos of strongly anchoring the environment.Also, last time it was provided as
nixosModules
, but since it actually only works with home-manager, we changed it tohomeManagerModules
. (breaking change) This is because I didn't know about the existence ofhomeManagerModules
last time.Additional information
main