lix/src/nix/flake-check.md
regnat d12b12a15b Let nix flake check keep going when keep-going is set
When the `keep-going` option is set to `true`, make `nix flake check`
continue as much as it can before failing.

The UI isn’t perfect as-it-is as all the lines currently start with a
mostly useless `error (ignored): error:` prefix, but I’m not sure what
the best output would be, so I’ll leave it as-it-is for the time being

(This is a bit hijacking the `keep-going` flag as it’s supposed to be a
build-time only thing. But I think it’s faire to reuse it here).

Fix https://github.com/NixOS/nix/issues/4450
2021-06-02 11:13:12 +02:00

1.7 KiB

R""(

Examples

  • Evaluate the flake in the current directory, and build its checks:

    # nix flake check
    
  • Verify that the patchelf flake evaluates, but don't build its checks:

    # nix flake check --no-build github:NixOS/patchelf
    

Description

This command verifies that the flake specified by flake reference flake-url can be evaluated successfully (as detailed below), and that the derivations specified by the flake's checks output can be built successfully.

If the keep-going option is set to true, Nix will keep evaluating as much as it can and report the errors as it encounters them. Otherise it will stop at the first error.

Evaluation checks

The following flake output attributes must be derivations:

  • checks.system.name
  • defaultPackage.system`
  • devShell.system`
  • nixosConfigurations.name`.config.system.build.toplevel
  • packages.system.name

The following flake output attributes must be app definitions:

  • apps.system.name
  • defaultApp.system`

The following flake output attributes must be template definitions:

  • defaultTemplate
  • templates.`name

The following flake output attributes must be Nixpkgs overlays:

  • overlay
  • overlays.`name

The following flake output attributes must be NixOS modules:

  • nixosModule
  • nixosModules.`name

The following flake output attributes must be bundlers:

  • bundlers.`name
  • defaultBundler

In addition, the hydraJobs output is evaluated in the same way as Hydra's hydra-eval-jobs (i.e. as a arbitrarily deeply nested attribute set of derivations). Similarly, the legacyPackages.system output is evaluated like nix-env -qa.

)""