Home-manager complains that home.stateVersion is not set but it is

Hi!

I’m using flake with home-manager.
This is my flake config:

{
  description = "jeansib's flake";

  inputs = {
    nixpkgs-unstable = {
      url = "github:nixos/nixpkgs/nixos-unstable";
    };
    nixpkgs-24-11 = {
      url = "github:nixos/nixpkgs/nixos-24.11";
    };
    nix-flatpak = {
      url = "github:gmodena/nix-flatpak/";
    };
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };
  };

  outputs = { self, nixpkgs-unstable, nixpkgs-24-11, nix-flatpak, home-manager, ... }@inputs:
    let
      system = "x86_64-linux";
    in
    {
      defaultPackage.x86_64-linux = home-manager.defaultPackage.x86_64-linux;
      homeConfigurations = {
        "jeansib" = home-manager.lib.homeManagerConfiguration {
          extraSpecialArgs = {
            pkgs-unstable = import nixpkgs-unstable {
              inherit system;
            };
            pkgs-24-11 = import nixpkgs-24-11 {
              inherit system;
            };
            inherit inputs;
          };
          pkgs = import nixpkgs-unstable { inherit system; };
        };
        modules = [
          nix-flatpak.nixosModules.nix-flatpak
          ./home.nix
        ];
      };
    };
}

This is my home.nix file:

{config, pkgs, inputs, nix-flatpak, ...}:

{
  nixpkgs = {
    config = {
      allowUnfree = true;
#      allowUnsupportedSystem = true;
    };
  };
  home = {
    stateVersion = "24.11";
    username = "jeansib";
    homeDirectory = "/home/jeansib";
    packages = with pkgs; [
      vscodium
      onedrive
      musescore
      syncthing
      libreoffice
      vlc
      rpi-imager
      mindustry-wayland
      teams-for-linux
      lua
      pdfmixtool

      protonvpn-gui
      protonmail-desktop
      proton-pass
    ];
  };
}

(omitted some systemd units as they are irrelevant)
When I run home-manager switch, I get the following error:

[jeansib@dell-3:~/.config/home-manager]$ home-manager switch
error:
       … while evaluating a branch condition
         at /nix/store/7hw19rbs6p20l2gxbf13la04pcs2znmz-source/lib/lists.nix:125:9:
          124|       fold' = n:
          125|         if n == len
             |         ^
          126|         then nul

       … while calling the 'length' builtin
         at /nix/store/7hw19rbs6p20l2gxbf13la04pcs2znmz-source/lib/lists.nix:123:13:
          122|     let
          123|       len = length list;
             |             ^
          124|       fold' = n:

       … while evaluating the option `programs.firefox.vendorPath':

       … while evaluating the module argument `pkgs' in "/nix/store/alm3nymx19kvkc8my31niws5d81b9pri-source/modules/programs/firefox.nix:anon-1":

       … while evaluating the module argument `pkgsPath' in "/nix/store/alm3nymx19kvkc8my31niws5d81b9pri-source/modules/misc/nixpkgs.nix":

       … while evaluating the option `home.stateVersion':

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

       error: The option `home.stateVersion' was accessed but has no value defined. Try setting the option.

[jeansib@dell-3:~/.config/home-manager]$ 

But home.stateVersion is clearly set in my home.nix file. What does it mean? Why it throws that error?

Can you try home-manager switch --flake '.#jeansib' just to be specific about it and rule out funny behavior?

[jeansib@dell-3:~/.config/home-manager]$ home-manager switch --flake '.#jeansib'
error:
       … while evaluating a branch condition
         at /nix/store/7hw19rbs6p20l2gxbf13la04pcs2znmz-source/lib/lists.nix:125:9:
          124|       fold' = n:
          125|         if n == len
             |         ^
          126|         then nul

       … while calling the 'length' builtin
         at /nix/store/7hw19rbs6p20l2gxbf13la04pcs2znmz-source/lib/lists.nix:123:13:
          122|     let
          123|       len = length list;
             |             ^
          124|       fold' = n:

       … while evaluating the option `programs.firefox.vendorPath':

       … while evaluating the module argument `pkgs' in "/nix/store/alm3nymx19kvkc8my31niws5d81b9pri-source/modules/programs/firefox.nix:anon-1":

       … while evaluating the module argument `pkgsPath' in "/nix/store/alm3nymx19kvkc8my31niws5d81b9pri-source/modules/misc/nixpkgs.nix":

       … while evaluating the option `home.stateVersion':

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

       error: The option `home.stateVersion' was accessed but has no value defined. Try setting the option.

[jeansib@dell-3:~/.config/home-manager]$ 

Gives me the same.

Output of git ls-files flake.nix home.nix?

[jeansib@dell-3:~/.config/home-manager]$ git ls-files flake.nix home.nix
fatal: not a git repository (or any of the parent directories): .git

[jeansib@dell-3:~/.config/home-manager]$ 

Oh. you closed the attrset too early. Move the line before modules to after it.

Yes! That was the case. Thank you very much, I hate these errors… I can stare 10 minutes and not see the simple answer.