Is it possible to use pure nixos channel home-manager?

I see that nixos.home-manager is present in packages but the home-manager documentation does not mention it and using it alone seems to not work:

  • nix-shell '<home-manager>' -A install fails as it cannot find home-manager
  • All commands complain about lack of nix-shell '<home-manager>' -A install

Is it possible to use nixos.home-manager without installing additional channels? If yes how to do it? If no - are there any plans?

Home manager has a couple of ways that you can use it, you can do one or the other but not both as they conflict with each other. if you install it via the package nixos.home-manager it will create the home-manager command line tool that you can personally use to manage you home directory. The upside for this method is everyone can manage their home directories independently of each other. The downside is that when you want to update things you have to update the NixOS channel first and then update your home manager config afterwards.

The other way to use it is as a module extention to NixOS, in this method you declare a user’s home configuration in your main NixOS configuration through the home-manager module. I don’t believe this is part of the home-manager package so you have to install it separately. Upside here is you only really have to do updates once and all home-manager managed packages get updated as well in one shot. The downside for this method is if you want to change something in a home manager configuration you have to rebuild/reevaluate the entire system which adds some time to the commands.

Personally having tried both, I find the module method preferrable, but that’s because I’m managing a single user personal computer. I’d image at some number of users you’d want to switch, especially if you have non-sudoers who want to be able to install software without getting a sudoer to run things for them.

To install the module you have a number of options, the simplest is to create a home-manager channel with nix-channel and this is recommended method described in the home-manager readme, the channel makes the <home-manager> symbol available so perhaps you missed that step. You can also use niv to manage it as an importable dependency, or if you’re using flakes already that would be the best way to incorporate it. I believe you can also use a fetchGit function, but that makes updating it rather manual so I wouldn’t recommend it.

To add on what wkral said, regardless if you use HM as a module or standalone, the NIX_PATH needs a home-manager entry, when used as a module, root needs to have it, standalone it is required for every user that wants to use HM.

This is where home-manager looks for its own nix files. The home-manager attribute in nixpkgs only provides the home--manager script.