Skip to content

nix flake check fails for overlays that check any attrs during construction of the attrset #54

@mitchmindtree

Description

@mitchmindtree

I'm unsure where to best open this, but it looks like this might be due to the schema determinate nix uses for nix flake check by default?

I started digging into this when running into the following CI errors during a nix flake check invocation:

error (ignored): attribute 'lib' missing
error:
       … while calling the 'isAttrs' builtin
         at «builtin-flake-schemas»/flake.nix:258:19:
          257|                 else
          258|                   builtins.isAttrs (overlay { } { });
             |                   ^
          259|             }) output

       … in the right operand of the update (//) operator
         at /home/runner/work/mindtrix/mindtrix/overlays/default.nix:30:3:
           29|   }
           30|   // (prev.lib.optionalAttrs prev.stdenv.isLinux {
             |   ^
           31|     # Disko scripts for mindlane partitioning and mounting.

       error: attribute 'lib' missing
       at /home/runner/work/mindtrix/mindtrix/overlays/default.nix:30:7:
           29|   }
           30|   // (prev.lib.optionalAttrs prev.stdenv.isLinux {
             |       ^
           31|     # Disko scripts for mindlane partitioning and mounting.
Error: Process completed with exit code 1.

It seems like an empty attrset is being provided to the prev argument of the function to test if the overlay is correctly producing an attrset. This causes a failure in the case that any of the attrs are used in the construction of the attrset itself (e.g. checking prev.stdenv.hostPlatform.isLinux).

It seems reasonable for an overlay to assume some basic content of the nixpkgs set might exist like stdenv no? The current nix flake check behaviour implies this is not the case.

Temporary Workaround

Set determinate: false in the nix-installer-action to use the normal nix behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions