Error: attribute 'pkgs-24-11' missing, while in flake inputs

Hi!

I’m trying to move my standalone home-manager file into a nixos module. This is my flake.nix:

{
  description = "Nixos config 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";
    };
    nix-index-db = {
      url = "github:nix-community/nix-index-database";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };
    plasma-manager = {
      url = "github:nix-community/plasma-manager";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
      inputs.home-manager.follows = "home-manager";
    };
  };

  outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-24-11, nix-flatpak, home-manager, nix-index-db, plasma-manager, ... }@inputs:
    let
      system = "x86_64-linux";
      pkgs = "nixpkgs.legacyPackages.${system}";
      pkgs-unstable = import nixpkgs-unstable {
        inherit system;
        config.allowUnfree = true;
      };
      pkgs-24-11 = import nixpkgs-24-11 {
        inherit system;
        config.allowUnfree = true;
      };
    in
    {
      nixosConfigurations.host-1 = nixpkgs.lib.nixosSystem {
        specialArgs = {
          inherit inputs;
        };
        modules = [
          nix-flatpak.nixosModules.nix-flatpak
          home-manager.nixosModules.home-manager
          {
            home-manager = {
              useGlobalPkgs = true;
              useUserPackages = true;
              extraSpecialArgs = { inherit inputs; };
              sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ];
              users = {
                jeansib = import ./home-manager/jeansib/home.nix;
              };
            };
          }
          nix-index-db.nixosModules.nix-index
          ./configuration.nix
        ];
      };
  }

But when I rebuild my system I get this error:

[root@host-1:/etc/nixos]# nixos-rebuild switch 
building the system configuration...
error:
       … while calling the 'head' builtin
         at /nix/store/32dh0g41x5w9zkqxqka3rj7h18blqhyh-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/32dh0g41x5w9zkqxqka3rj7h18blqhyh-source/lib/modules.nix:846:9:
          845|     in warnDeprecation opt //
          846|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          847|         inherit (res.defsFinal') highestPrio;

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

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

       … while evaluating the option `warnings':

       … while evaluating definitions from `/nix/store/32dh0g41x5w9zkqxqka3rj7h18blqhyh-source/nixos/modules/system/boot/systemd.nix':

       … while evaluating the option `systemd.services.home-manager-helenajurkowska.serviceConfig':

       … while evaluating definitions from `/nix/store/2rfas9zi1rivhpk57gmyhvmflsmnlh2m-source/nixos':

       … while evaluating the option `home-manager.users.helenajurkowska.home.file."/home/helenajurkowska/.config/fontconfig/conf.d/10-hm-fonts.conf".source':

       … while evaluating definitions from `/nix/store/2rfas9zi1rivhpk57gmyhvmflsmnlh2m-source/modules/files.nix':

       … while evaluating the option `home-manager.users.helenajurkowska.home.file."/home/helenajurkowska/.config/fontconfig/conf.d/10-hm-fonts.conf".text':

       … while evaluating definitions from `/nix/store/2rfas9zi1rivhpk57gmyhvmflsmnlh2m-source/modules/misc/xdg.nix':

       … while evaluating the option `home-manager.users.helenajurkowska.xdg.configFile."fontconfig/conf.d/10-hm-fonts.conf".text':

       … while evaluating definitions from `/nix/store/2rfas9zi1rivhpk57gmyhvmflsmnlh2m-source/modules/misc/fontconfig.nix':

       … while evaluating the option `home-manager.users.helenajurkowska.home.packages':

       … while evaluating definitions from `/nix/store/32dh0g41x5w9zkqxqka3rj7h18blqhyh-source/flake.nix':

       … while evaluating the module argument `pkgs-24-11' in ":anon-6:anon-1":

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

       error: attribute 'pkgs-24-11' missing
       at /nix/store/32dh0g41x5w9zkqxqka3rj7h18blqhyh-source/lib/modules.nix:515:28:
          514|         addErrorContext (context name)
          515|           (args.${name} or config._module.args.${name})
             |                            ^
          516|       ) (functionArgs f);

[root@host-1:/etc/nixos]# 

What does it mean, that this attribute is missing? It is declared in inputs and in outputs, or maybe the problem is with hom.nix import?

You need to add it to specialArgs - or use the inputs.nixpkgs-24-11 that you did add.

If you want to use unfree with flake inputs you can use this, by the way, saves you the additional nixpkgs evals: GitHub - numtide/nixpkgs-unfree: nixpkgs with the unfree bits enabled

Thank you! That worked.