mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-12-06 04:40:10 +00:00
nixos/top-level: keep nix flake check catching failed assertions
If we make toplevel its own type, we can make `nix flake check` continue to check and `nix flake show` fast.
This commit is contained in:
@@ -156,7 +156,24 @@ in
|
||||
|
||||
system.build = {
|
||||
toplevel = mkOption {
|
||||
type = types.package;
|
||||
type = lib.mkOptionType {
|
||||
name = "nixosToplevel";
|
||||
description = "package";
|
||||
descriptionClass = "noun";
|
||||
# Only check for the existence of `drvPath` and `outPath` so that `nix flake show` is fast
|
||||
check = x: x ? drvPath && x ? outPath;
|
||||
merge =
|
||||
loc: defs:
|
||||
let
|
||||
toplevel = lib.mergeOneOption loc defs;
|
||||
in
|
||||
toplevel
|
||||
// {
|
||||
# Check assertions when something asks about the type (e.g. `nix flake check`),
|
||||
# leaving `name` cheap so that `nix flake show` is fast.
|
||||
type = lib.asserts.checkAssertWarn config.assertions [ ] toplevel.type;
|
||||
};
|
||||
};
|
||||
readOnly = true;
|
||||
description = ''
|
||||
This option contains the store path that typically represents a NixOS system.
|
||||
|
||||
Reference in New Issue
Block a user