I cannot find my home-manager command

Hi, I am trying to install home-manager as a nixos module following the instruction in sec-install-nixos-module. However, after finishing the configuration and nixos-rebuild switch, I cannot find my home-manager command.
here is some relevant code of my /etc/nixos/configuration.nix:

imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
      <home-manager/nixos>
    ];

  home-manager.backupFileExtension = "backup";
  home-manager.useUserPackages = true;
  home-manager.users.yl = {pkgs, ... }:{
    home.packages = [pkgs.atool pkgs.htop];
    home.stateVersion = "24.11";
    
  };

And here is the result of nix-channel --list

home-manager https://github.com/nix-community/home-manager/archive/master.tar.gz
nixos https://nixos.org/channels/nixos-24.11

I am using zsh, and I have added this line to my .zshrc

. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"

what does the outputs of these commands say:

systemctl status "home-manager-$USER.service"
journalctl -xe --unit home-manager-yl

also are you getting errors when you rebuild?

1 Like

You should enable the command with programs.home-manager.enable. But it might not be that useful if you are using home-manager module for NixOS.

1 Like

You should not have a home-manager command when using the NixOS module (i.e. do not use program.home-manager.enable). In such a case, you rebuild your HM config by rebuilding your system config.

Also you probably don’t want a user channel named nixos, you should probably remove that.
And ensure you’re using the correct home-manager channel that corresponds with the nixpkgs channel that you use to build your system.

1 Like