Problem with Home Manager


Hey! I’m having an issue with installing Home Manager. I don’t understand what’s wrong, but I can’t find it anywhere. How do I install it? Here’s my flake.nix file if it’s needed for troubleshooting:

{
  description = "tlater's dotfiles";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
    nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";

    home-manager = {
      url = "github:nix-community/home-manager/release-24.11";
      inputs.nixpkgs.follows = "nixpkgs";
    };

  };

  outputs =
      { nixpkgs, home-manager, ... }@inputs :
      {
        nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
            system = "x86_64-linux";
            modules = [
              { nixpkgs.config.allowUnfree = true; }
              ./nix/configuration.nix
            ];
        };

        homeConfigurations.yakatze = home-manager.lib.homeManagerConfiguration {
          pkgs = nixpkgs.legacyPackages."x86_64-linux";
          modules = [ ./home/home.nix ];
          extraSpecialArgs = {inherit inputs;};
        };

      };

}

What is it you can not find anywhere?

This flake.nix provides a standalone user configuration which is to be built and switched via home-manager switch --flake /path/to/your/flake#yakatze, and if your current user is named “yakatze”, you can omit the #yakatze, but you still have to provide the location of the flake.

The thing is, I built the system using a flake, but for some reason, home-manager is not present in the system.

I see that you use a flake. So did you run home-manager switch --flake /path/to/flake? If you are still in the bootstrapping, or missed to set programs.home-manager.enable = true before the bootstrapping, you can get home-manager temporarily by using nix shell nixpkgs#home-manager or directly using nix run nixpkgs#home-manager -- switch --flake /path/to/flake.

I run sudo nixos-rebuild switch --flake . and, just in case, also run sudo nixos-rebuild switch. I reboot the system, but I still don’t have home-manager. I don’t understand why—maybe my flake.nix is not set up correctly. I just can’t figure out what the problem is.

Youre flake.nix suggests that you are using HM standalone, nixos-rebuild is unrelated.

So, I did run home-manager switch --flake /path/to/flake, but I think I didn’t include programs.home-manager.enable = true.

You do not need it, it just is more convinient that way, as HM will ensure the HM CLI remains up to date and “installed”.

In theory, there is no need to have it permanently installed, as you always can nix shell or nix run to get it temporarily.

But isn’t it impossible to install applications without having home-manager installed?

No, as you can either use the system config, or (as already explained) get the HM CLI temporarily whenever you need it.

And of course, the latter is everything but convinient.

Well, no, I don’t want home-manager to be temporary — but I still don’t fully understand how to set it up properly and where to write the configuration to install it.

In your home config you enable programs.home-manager.enable, and then you use HM to build and activate the new home config. If you haven’t HM in path, you have to do the temporary thing, at least for this last time.