Using similar code for my neovim config does work properly.
After some additional testing I noticed that neither setting enable = false nor removing whole snippet does remove git from the system. Git is not declared anywhere else in .nix files and I did not install it through nix-env. Before using home manager I had it in environment.systemPackages in configuration.nix, but later removed it. Having it back in does not change anything.
Some commands that I did try:
[user@host:~]$ nix-env --uninstall git
warning: selector 'git' matched no installed derivations
[user@host:~]$ which git
/home/user/.nix-profile/bin/git
[user@host:~]$ which git | xargs realpath
/nix/store/q1zaii9cirbfpmwr7d86hpppql3kjcpf-git-2.51.0/bin/git
I’m pretty new to NixOS and still learning the Nix way of doing things, so I will appreciate any hints what might be wrong.
Alright obviously I am just a newbie but there is an interesting fact for me is that .nix-profile is a broken symbolic link in my laptop. This piqued my curiosity, so I did a little research, and now I’m here to tell you what I think.
Firstly, after a bit of searching, I got this manual page. So I guess your git may be installed by something like this:
nix-env -iA nixpkgs.<package> # old
nix profile install nixpkgs#<package> # new
But now that you’re mentioning below, I’m not quite sure what’s going on.
Nevertheless, maybe you can still try these command to find packages in your profile:
nix-env --query --installed
nix profile list
And according to your thread maybe try below to remove git from your profile. You can do it twice, once as a normal user and once as root. Not guaranteed to work.
For <git-with-version-number>, maybe you will get it from the output of nix-env --query --installed.
After this, maybe the mysterious git will be uninstalled (or not ). And for your main problem, I just recommend that paste your repo address so that people can check your code.
EDIT: here is my knowledge resource (Sounds like a bit AI but I am really not ).
The underlying problem has been me mixing two types of using home manager - due to my lack of understanding I was using syntax for standalone version, while at the same time my home manager was installed as a module. Of course sharing repo with the config would let you spot that right away, but I didn’t have it in the repo due to issues with git - I couldn’t create a commit without email and name set and couldn’t set them due to config not working Everything was working fine before I tried to modularise while not fully understanding what I was doing, thus not properly sourcing some files.
As a summary I used a flake.nix (shortened version with only lines regarding home manager):