Add input to flake.nix:

home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
flake.nix:inputs

Add the module to modules list of nixosSystem calls:

inputs.home-manager.nixosModules.home-manager
nixos
{
  home-manager.sharedModules = [
    <<home-manager-modules>>
  ];
}
nixos

Use the same package set and nixpkgs options (e.g. allowUnfree) as NixOS. Also use the user packages profile of NixOS:

{
  home-manager.useGlobalPkgs = true;
  home-manager.useUserPackages = true;
}
nixos

Make home-manager output show-up in result of nixos-rebuild --build

{ lib, config, ... }:
 
{
  system.extraSystemBuilderCmds = ''
    mkdir -p $out/home-manager
    ${lib.concatStringsSep "\n" (
      map (cfg: "ln -sn ${cfg.home.activationPackage} $out/home-manager/${cfg.home.username}") (
        lib.attrValues config.home-manager.users
      )
    )}
  '';
}
nixos
{
  home.stateVersion = "24.11";
}
home-manager