Home-Manager version is newer than nixpkgs

Hi!

I am quite new to NixOS, and have started out with flakes and Home-Manager. I have gotten some things to work, but now I encountered a few problems where I cant really figure out what to do.

I recently tried to add ZSH as my users default shell, then configure ZSH via Home-Manager. The first issues is that; whenever I open a new ZSH prompt, I am given the zsh-newuser-install menu, even though I have tried to configure some things via Home-Manager. I guess my Home-Manager setup of ZSH is not working correctly, and I assume it is due to me not fully grasping Nix modules, so maybe someone could help me understand what the problem is here?

Secondly, I found that running nix run home-manager -- switch -f home.nix (in the directory of my home.nix file) I get an error message stating my Nixpkgs is 25.05, and my Home-Manager is 25.11. From what I configured, I thought my Home-Manager version would be 25.05 as well?

These are my files:
~/config/flake.nix:

{
  description = "My system flake";
  
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
    
    home-manager = {
      url = "github:nix-community/home-manager/release-25.05";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, home-manager, ... }: rec {
    homeModules = import ./home;
    nixosConfigurations.linux-desktop = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = (builtins.attrValues homeModules) ++ [
        ./configuration.nix
        home-manager.nixosModules.home-manager {
          home-manager = {
            useGlobalPkgs = true;
            useUserPackages = true;
            users.moggel = import ./home.nix;
            backupFileExtension = "nxbackup";
          };
        }
      ];
    };
  };
}

~/config/home.nix:

{ config, pkgs, ... }:

{
  # Setup user and home
  home.username = "moggel";
  home.homeDirectory = "/home/moggel";

  # Setup config links
  home.file.".config/hypr/hyprland.conf".source = ./hyprland.conf;
  home.file.".gitconfig".source = ./gitconfig;
  home.file.".config/nvim".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/nvim";

  programs.waybar.enable = true;

  # Setup user packages
  home.packages = with pkgs; [
    btop
    fzf
    nmap
    zsh
    bitwarden-desktop
  ];


  # This value determines the home Manager release that your
  # configuration is compatible with. This helps avoid breakage
  # when a new home Manager release introduces backwards 
  # incompatible changes.
  # 
  # You can update home Manager without changing this value. See
  # the home Manager release notes for a list of state version 
  # changes in each release.
  home.stateVersion = "25.05";
}

~/config/home/default.nix:

{
  homeModules = import ./modules;
}

~/config/home/modules/default.nix:

{
  imports = [
    ./zsh.nix
  ];
}

~/config/home/modules/zsh.nix:

{ config, pkgs, ... }: 

{
  programs.zsh = {
    enable = true;
    autosuggestions.enable = true;
    enableCompletion = true;
    enableLsColors = true;
    setOptions = [
      "HIST_IGNORE_DUPS"
      "SHARE_HISTORY"
      "HIST_FCNTL_LOCK"
      "AUTO_CD"
    ];

    shellInit = ''
      bindkey -e
      bindkey "^[[1;5C" forward-word
      bindkey "^[[1;5D" backward-word

    '';
  };
}

I don’t know if this is a version issue. When you do nix run home-manager -- switch -f home.nix, it uses the latest version of home-manager, regardless of your config (I think); you are installing home-manager as a NixOS module, so nixos-rebuild switch should work with HM on its own, using the desired version.

Also, do you have any ~/.zshrc, or zsh-related config file in your home after you nixos-rebuild switch (plus reboot, in case…)?

When you use the home-manager cli, it defaults to using nixos channels rather than what is in your flake. In other words whatever is in nix-channel --list

I suggest either using home manager as a nixos-module in your system config, or if you insist on using standalone, creating new outputs for your home manager configuration in your flake.nix and using home-manager switch --flake <flake-ref>

Edit:
I now see you have this in your flake.nix

home-manager.nixosModules.home-manager {
  home-manager = {
    useGlobalPkgs = true;
    useUserPackages = true;
    users.moggel = import ./home.nix;
    backupFileExtension = "nxbackup";
  }
}

which means you are already using home manager as a nixos module.

Since you are using it as a nixos module, you should not be using the home-manager cli. Instead, updates to your user environment will come with nixos-rebuild.

I think you need to remove homeModules = import ./home; and (builtins.attrValues homeModules) ++ from flake.nix, and add imports = [ ./home/modules ]; into home.nix. This will use HM to manage zsh, instaid of NixOS system config. You probably will need to change some options (for example switch from shellInit to initContent).

And as said above, use nixos-rebuild switch instaid of nix run home-manager -- switch -f home.nix or another fancy command