Rebuild errors, with attrsets and tensorflow

This error have blocked me.

[root@cynix:/etc/nixos]# nixos-rebuild switch
building Nix...
building the system configuration...
error:
       … while calling the 'head' builtin

         at /nix/store/b7fslslwv7xxgicazc77bbj3hxa2i817-nixos/nixos/lib/attrsets.nix:820:11:

          819|         || pred here (elemAt values 1) (head values) then
          820|           head values
             |           ^
          821|         else

       … while evaluating the attribute 'value'

         at /nix/store/b7fslslwv7xxgicazc77bbj3hxa2i817-nixos/nixos/lib/modules.nix:800:9:

          799|     in warnDeprecation opt //
          800|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          801|         inherit (res.defsFinal') highestPrio;

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

       error: Package ‘python3.10-tensorflow-2.11.1’ in /nix/store/b7fslslwv7xxgicazc77bbj3hxa2i817-nixos/nixos/pkgs/development/python-modules/tensorflow/default.nix:446 is marked as broken, refusing to evaluate.

       a) To temporarily allow broken packages, you can use an environment variable
          for a single invocation of the nix tools.

            $ export NIXPKGS_ALLOW_BROKEN=1

        Note: For `nix shell`, `nix build`, `nix develop` or any other Nix 2.4+
        (Flake) command, `--impure` must be passed in order to read this
        environment variable.

       b) For `nixos-rebuild` you can set
         { nixpkgs.config.allowBroken = true; }
       in configuration.nix to override this.

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allowBroken = true; }
       to ~/.config/nixpkgs/config.nix.

[root@cynix:/etc/nixos]# 

How do I track down the problem?

You must be using python3Packages.tensorflow somewhere in your closure, which is currently broken on nixpkgs-unstable:

I don’t really have any mentions of python3Packages.tensorflow, so it must be some kind
of dependency.

Compiling retry.

building Nix...
building the system configuration...
error:
       … while calling the 'head' builtin

         at /nix/store/78ag6hsm2qimprlqlfm0p9gy88yzldas-nixos/nixos/lib/attrsets.nix:820:11:

          819|         || pred here (elemAt values 1) (head values) then
          820|           head values
             |           ^
          821|         else

       … while evaluating the attribute 'value'

         at /nix/store/78ag6hsm2qimprlqlfm0p9gy88yzldas-nixos/nixos/lib/modules.nix:800:9:

          799|     in warnDeprecation opt //
          800|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          801|         inherit (res.defsFinal') highestPrio;

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

       error: Package ‘python3.10-tensorflow-2.11.1’ in /nix/store/78ag6hsm2qimprlqlfm0p9gy88yzldas-nixos/nixos/pkgs/development/python-modules/tensorflow/default.nix:446 is marked as broken, refusing to evaluate.

       a) To temporarily allow broken packages, you can use an environment variable
          for a single invocation of the nix tools.

            $ export NIXPKGS_ALLOW_BROKEN=1

        Note: For `nix shell`, `nix build`, `nix develop` or any other Nix 2.4+
        (Flake) command, `--impure` must be passed in order to read this
        environment variable.

       b) For `nixos-rebuild` you can set
         { nixpkgs.config.allowBroken = true; }
       in configuration.nix to override this.

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allowBroken = true; }
       to ~/.config/nixpkgs/config.nix.

Seems to included from this.

[root@cynix:/etc/nixos]# nix-store --query --referrers-closure  /nix/store/78ag6hsm2qimprlqlfm0p9gy88yzldas-nixos/
/nix/store/78ag6hsm2qimprlqlfm0p9gy88yzldas-nixos
/nix/store/p7pzlm99h8gzlvf87p2vsmw8g16hv7r4-env-manifest.nix
/nix/store/vbj0w8bkz4blqapcrsllvkv1zv6bxsvp-user-environment
/nix/store/w2gywdgq6m2a8dx2irzs5fcilr69ba69-user-environment.drv

I solved for now by changing from unstable to the stable branch.