home.stateVersion used but not defined

   error: The option `home.stateVersion' is used but not defined.

above is the error I get when I run “home-manager switch”

/etc/nixos/configuration.nix

{ config, pkgs, ... }:

{
  imports =
    [
      ./hardware-configuration.nix
      <home-manager/nixos>
    ];
  boot = {
    
    loader.systemd-boot.enable = true;
    loader.efi.canTouchEfiVariables = true;
    
    plymouth = {
      enable = true;
    };
  
    initrd.secrets = {
      "/crypto_keyfile.bin" = null;
    };
    
    initrd.luks.devices."luks-deaeb5ca-54f0-4929-9408-7e132a6a33aa".device = "/dev/disk/by-uuid/deaeb5ca-54f0-4929-9408-7e132a6a33aa";
    initrd.luks.devices."luks-deaeb5ca-54f0-4929-9408-7e132a6a33aa".keyFile = "/crypto_keyfile.bin";
  
  };
  
  console = {
  
      earlySetup = true;
      keyMap = "colemak";
  
  };
  
  networking.hostName = "nixos"; # Define your hostname.
  networking.networkmanager.enable = true;

  time.timeZone = "America/Chicago";

  i18n.defaultLocale = "en_US.UTF-8";
  i18n.extraLocaleSettings = {
    LC_ADDRESS = "en_US.UTF-8";
    LC_IDENTIFICATION = "en_US.UTF-8";
    LC_MEASUREMENT = "en_US.UTF-8";
    LC_MONETARY = "en_US.UTF-8";
    LC_NAME = "en_US.UTF-8";
    LC_NUMERIC = "en_US.UTF-8";
    LC_PAPER = "en_US.UTF-8";
    LC_TELEPHONE = "en_US.UTF-8";
    LC_TIME = "en_US.UTF-8";
  };

  nix.settings.experimental-features =[ "nix-command" "flakes" ];
  
  services.xserver = {
    layout = "us";
    xkbVariant = "colemak";
  };

  powerManagement.powertop.enable = true;
  services.auto-cpufreq.enable = true;
  services.auto-cpufreq.settings = {
    battery = {
      governor = "powersave";
      turbo = "never";
    };
    charger = {
      governor = "performance";
      turbo = "auto";
    };
  };

  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    jack.enable = true;
  };

  home-manager.users.histic = {
    programs.home-manager.enable = true;
    programs.zsh.enable = true;
    home.stateVersion = "23.05";
  };
  
  users.users.histic = {
    isNormalUser = true;
    shell = with pkgs; zsh;
    description = "histic";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [ ##this is only here till i figure out the error
      helix
      hyprpaper
      firefox
      nnn
      git
      tlp
      powertop
      eww-wayland
      nwg-panel
      discord
      cliphist
      kitty
      tofi
      zsh
    ];
  };
  
  fonts = { 
    packages = with pkgs; [
      cozette
      spleen
    ];
    fontconfig = {
      defaultFonts = {
        monospace = [ "Cozette" ];
      };
    };
  };

  
  services.greetd = {
    enable = true;
    settings = {
      default_session = {
        command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --remember --cmd Hyprland";
        user = "greeter";
      };
    };
  };

  hardware = {
    bluetooth = {
      enable = true;
      powerOnBoot = true;
    };
  };
  services.blueman.enable = true;
  
  systemd.services.greetd.serviceConfig = {
    Type = "idle";
    StandardInput = "tty";
    StandardOutput = "tty";
    StandardError = "journal";
    TTYReset = true;
    TTYVHangup = true;
    TTYVTDisallocate = true;
  };
  
  programs.zsh.enable = true;
  programs.hyprland.enable = true;
  
  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;
  environment.systemPackages = with pkgs; [
    home-manager
    zsh
    helix
  ];
  
  system.stateVersion = "23.05";
}

~/.config/home-manager/home.nix

{ config, pkgs, ... }:

{
  home.username = "histic";
  home.homeDirectory = "/home/histic";
  home.stateVersion = "23.05";

  programs.home-manager.enable = true;
  fonts.fontconfig.enable = true;

  home.packages = with pkgs; [
    helix
    hyprpaper
    firefox
    nnn
    git
    tlp
    powertop
    nwg-panel
    discord
    cozette
    spleen
    cliphist
    kitty
    tofi
    zsh
    eww-wayland
  ];

  programs.zsh.enable = true;
  programs.hyprland.enable = true;
  
}

If you use the home-manager module, rather than the standalone command, your home-manager config needs to be part of the system config, supplied to the home-manager.users."<name>" option. ~/.config/home-manager/home.nix ends up never being read.

You could work around this with impure eval by setting:

home-manager.users.histic = import /home/histic/.config/home-manager/home.nix;

Though I sincerely suggest not doing that and instead moving that home.nix to a relative path that’s part of the git repo.

Follow these instructions from the manual: Home Manager Manual

so i did the standalone install as in the home-manager wiki and when i run the nix-shell install command it works and uses the home.nix file but when i run home-manager switch it fails with the same error of home.stateversion not defined but clearly is to my understanding

{ config, pkgs, ... }:

{
  nixpkgs = {
    config = {
      allowUnfree = true;
    };
  };
  home = {
    username = "histic";
    homeDirectory = "/home/histic";
    stateVersion = "23.05";
  };
  programs = {
    home-manager.enable = true;
    zsh = {
      enable = true;
    };
    
  };

  home.packages = with pkgs; [
    helix
    hyprpaper
    firefox
    nnn
    git
    tlp
    powertop
    nwg-panel
    discord
    cozette
    spleen
    cliphist
    kitty
    tofi
    zsh
    eww-wayland
  ];

  fonts.fontconfig.enable = true;
}
{ config, pkgs, ... }:

{
  imports =
    [
      ./hardware-configuration.nix
    ];
  boot = {
    
    loader.systemd-boot.enable = true;
    loader.efi.canTouchEfiVariables = true;
    
    plymouth = {
      enable = true;
    };
  
    initrd.secrets = {
      "/crypto_keyfile.bin" = null;
    };
    
    initrd.luks.devices."luks-deaeb5ca-54f0-4929-9408-7e132a6a33aa".device = "/dev/disk/by-uuid/deaeb5ca-54f0-4929-9408-7e132a6a33aa";
    initrd.luks.devices."luks-deaeb5ca-54f0-4929-9408-7e132a6a33aa".keyFile = "/crypto_keyfile.bin";
  
  };
  
  console = {
  
      earlySetup = true;
      keyMap = "colemak";
  
  };
  
  networking.hostName = "nixos"; # Define your hostname.
  networking.networkmanager.enable = true;

  time.timeZone = "America/Chicago";

  i18n.defaultLocale = "en_US.UTF-8";
  i18n.extraLocaleSettings = {
    LC_ADDRESS = "en_US.UTF-8";
    LC_IDENTIFICATION = "en_US.UTF-8";
    LC_MEASUREMENT = "en_US.UTF-8";
    LC_MONETARY = "en_US.UTF-8";
    LC_NAME = "en_US.UTF-8";
    LC_NUMERIC = "en_US.UTF-8";
    LC_PAPER = "en_US.UTF-8";
    LC_TELEPHONE = "en_US.UTF-8";
    LC_TIME = "en_US.UTF-8";
  };

  nix.settings.experimental-features =[ "nix-command" "flakes" ];
  
  services.xserver = {
    layout = "us";
    xkbVariant = "colemak";
  };

  powerManagement.powertop.enable = true;
  services.auto-cpufreq.enable = true;
  services.auto-cpufreq.settings = {
    battery = {
      governor = "powersave";
      turbo = "never";
    };
    charger = {
      governor = "performance";
      turbo = "auto";
    };
  };

  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    jack.enable = true;
  };
  
  users.users.histic = {
    isNormalUser = true;
  #  shell = with pkgs; zsh;
  #  description = "histic";
    extraGroups = [ "networkmanager" "wheel" ];
  #  packages = with pkgs; [
  #    helix
  #    hyprpaper
  #    firefox
  #    nnn
  #    spleen
  #    git
  #    tlp
  #    powertop
  #    eww-wayland
  #    nwg-panel
  #    cozette
  #    discord
  #    cliphist
  #    kitty
  #    tofi
  #    zsh
  #  ];
  };
  
  #fonts = { 
  #  packages = with pkgs; [
  #    cozette
  #    spleen
  #  ];
  #  fontconfig = {
  #    defaultFonts = {
  #      monospace = [ "Cozette" ];
  #    };
  #  };
  #};

  
  services.greetd = {
    enable = true;
    settings = {
      default_session = {
        command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --remember --cmd Hyprland";
        user = "greeter";
      };
    };
  };

  hardware = {
    bluetooth = {
      enable = true;
      powerOnBoot = true;
    };
  };
  services.blueman.enable = true;
  
  systemd.services.greetd.serviceConfig = {
    Type = "idle";
    StandardInput = "tty";
    StandardOutput = "tty";
    StandardError = "journal";
    TTYReset = true;
    TTYVHangup = true;
    TTYVTDisallocate = true;
  };
  
  programs.zsh.enable = true;
  programs.hyprland.enable = true;
  
  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;
  environment.systemPackages = with pkgs; [
    zsh
    helix
  ];
  
  system.stateVersion = "23.05";
}

What exact commands are you running? Are the files still in the same locations?