Getting "error: attribute 'defaultPriority' missing" after updating nixpkgs-unstable flake

Hi folks,

I started to see the following error after updating the nixpkgs-unstable flake reference (I used to have the version from 5th August, which built just fine).

$ nixos-rebuild build --flake ~/Coding/github.com/rytswd/nix-config#asus-rog-zephyrus-g14-2024 --show-trace --option eval-cache false

...(snip)...

       … while calling 'check'

         at /nix/store/6dxvxz52z172kxdi97bw4grpkhzx4dx7-source/lib/types.nix:535:15:

          534|       descriptionClass = "noun";
          535|       check = x: isStringLike x && builtins.substring 0 1 (toString x) == "/";
             |               ^
          536|       merge = mergeEqualOption;

       … while evaluating derivation 'system-path'
         whose name attribute is located at /nix/store/7qkcm6k8phjcjndpqxh2p6why320dqsq-source/pkgs/stdenv/generic/make-derivation.nix:336:7

       … while evaluating attribute 'passAsFile' of derivation 'system-path'

         at /nix/store/7qkcm6k8phjcjndpqxh2p6why320dqsq-source/pkgs/build-support/trivial-builders/default.nix:60:9:

           59|         inherit buildCommand name;
           60|         passAsFile = [ "buildCommand" ]
             |         ^
           61|           ++ (derivationArgs.passAsFile or [ ]);

       error: attribute 'defaultPriority' missing

       at /nix/store/7qkcm6k8phjcjndpqxh2p6why320dqsq-source/nixos/modules/config/system-path.nix:6:67:

            5|
            6|   requiredPackages = map (pkg: lib.setPrio ((pkg.meta.priority or lib.meta.defaultPriority) + 3) pkg)
             |                                                                   ^
            7|     [ pkgs.acl

If I’m understanding the error trace correctly, I probably have some old nixpkgs reference left around, which is trying to use the latest system-path.nix and failing to get the reference to lib.meta.defaultPriority.

I dug into my Nix configurations and tried all sorts to update flake reference to follow the same nixpkgs-unstable, and removed some components to see if I could iron out. But I haven’t been able to pinpoint where this is coming from.

I couldn’t see any reference tree with nix-store command either – all of the below commands return nothing at all.

nix-store --query --references /nix/store/7qkcm6k8phjcjndpqxh2p6why320dqsq-source/
nix-store --query --referrers /nix/store/7qkcm6k8phjcjndpqxh2p6why320dqsq-source/
nix-store --query --referrers /nix/store/6dxvxz52z172kxdi97bw4grpkhzx4dx7-source/
nix-store --query --references /nix/store/6dxvxz52z172kxdi97bw4grpkhzx4dx7-source/

I didn’t paste the full trace above as it looked more about the lambda func call chains, and I could not spot where this is originally coming from.

I’d appreciate any suggestions, as I’m really out of ideas…

(Side Note: The full config is publicly available here, but because the build is failing, I haven’t pushed the updated flake.lock. If it would be helpful, I can push that to a separate branch.)

Found the error with my flake.nix setup, where I was using nixpkgs and nixpkgs-unstable interchangeably – specifically for lib and nixosSystem.

nixosConfigurations = {
          asus-rog-zephyrus-g14-2024 = (import ./nixos-config/asus-rog-zephyrus-g14-2024 {
            inherit (nixpkgs) lib; # <-- HERE, this should match nixosSystem below
            inherit (nixpkgs-unstable.lib) nixosSystem;
            inherit nixpkgs nixpkgs-unstable home-manager;
            inherit inputs;
            system = "x86_64-linux";
            overlays = overlays;
          });

I suppose it’s another question whether I want to keep using nixpkgs-unstable for everything, or stick to stable for the OS setup. But for now, I can make sure my configuration would continue to work. Sorry for the noise here!