Probably some installation error about home-manager

When I try to use home-manager, the following error appears when executing sudo nixos-rebuild switch

error:
       … while calling the 'head' builtin
         at /nix/store/idq1bmwwy9rlkc21hccvx42wlwpxsx1f-source/lib/attrsets.nix:1574:11:
         1573|         || pred here (elemAt values 1) (head values) then
         1574|           head values
             |           ^
         1575|         else

       … while evaluating the attribute 'value'
         at /nix/store/idq1bmwwy9rlkc21hccvx42wlwpxsx1f-source/lib/modules.nix:816:9:
          815|     in warnDeprecation opt //
          816|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          817|         inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/store/idq1bmwwy9rlkc21hccvx42wlwpxsx1f-source/nixos/modules/system/activation/top-level.nix':

       … while evaluating the option `home-manager.users.foxo.home.homeDirectory':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: The option `home-manager.users.foxo.home.homeDirectory' has conflicting definition values:
       - In `/nix/store/idq1bmwwy9rlkc21hccvx42wlwpxsx1f-source/flake.nix': "/home/foxo"
       - In `/nix/store/l68z5vq2qh6yazcv80d50sw2b4d1z0wq-source/nixos/common.nix': "/var/empty"
       Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.

The following are configuration.nix, flake.nix, home.nix:

/etc/nixos/configuration.nix

# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).

{ config, lib, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Use the systemd-boot EFI boot loader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  networking.hostName = "nixos"; # Define your hostname.
  # Pick only one of the below networking options.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
  networking.networkmanager.enable = true;  # Easiest to use and most distros use this by default.

  # Set your time zone.
  time.timeZone = "Asia/Shanghai";

  i18n.defaultLocale = "en_US.UTF-8";

  services.xserver.enable = true;
  services.displayManager.sddm.enable = true;
  services.desktopManager.plasma6.enable = true;


  

  # Configure keymap in X11
  # services.xserver.xkb.layout = "us";
  # services.xserver.xkb.options = "eurosign:e,caps:escape";

  # Enable CUPS to print documents.
  # services.printing.enable = true;

  # Enable sound.
  # hardware.pulseaudio.enable = true;
  # OR
  services.pipewire = {
    enable = true;
    pulse.enable = true;
  };

  programs.firefox.enable = true;

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  nix.settings.experimental-features = [ "nix-command" "flakes" ];
  environment.systemPackages = with pkgs; [
    vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
    wget
    git
    curl
    open-vm-tools
    noto-fonts-cjk-sans
    noto-fonts-cjk-serif
  ];

  nix.settings.substituters = [
    "https://mirrors.ustc.edu.cn/nix-channels/store"
  ];
  system.stateVersion = "24.11"; # Did you read the comment?

}

/etc/nixos/flake.nix

  {
  description = "NixOS configuration";

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

  outputs = inputs@{ nixpkgs, home-manager, ... }: {
    nixosConfigurations = {
      nixos = nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
        modules = [
          ./configuration.nix
          home-manager.nixosModules.home-manager
          {
            home-manager.useGlobalPkgs = true;
            home-manager.useUserPackages = true;
            home-manager.users.foxo = import ./home.nix;

            # Optionally, use home-manager.extraSpecialArgs to pass
            # arguments to home.nix
          }
        ];
      };
    };
  };
}

/etc/nixos/home.nix

{ config, pkgs, ... }:

{
	home.username = "foxo";
	home.homeDirectory = "/home/foxo";

	home.packages = with pkgs;[
		fastfetch
	];

	home.stateVersion = "24.11";

	programs.home-manager.enable = true;
}

Is there something wrong?
If more information is needed, please let me know.
Thank you very much

You also need to configure the foxo user in your configuration.nix file. See the relevant manual section for details.

At a minimum, you want

users.users.foxo.isNormalUser = true;

which will resolve this particular conflict.

Ah! It worked. Thank you very much!

That error message could definitely be improved with an assertion tbf