mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-31 16:14:46 +02:00
modules/output: check warnings+assertions on build.package
Add a `build.packageUnchecked` option for use instead of the old `check` evalNixvim argument.
This commit is contained in:
parent
2ea7009e61
commit
6a1bf6bdc3
9 changed files with 50 additions and 48 deletions
|
@ -73,7 +73,30 @@ in
|
|||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
description = "Wrapped Neovim.";
|
||||
description = ''
|
||||
Wrapped Neovim.
|
||||
|
||||
> [!NOTE]
|
||||
> Evaluating this option will also check `assertions` and print any `warnings`.
|
||||
> If this is not desired, you can use `build.packageUnchecked` instead.
|
||||
'';
|
||||
readOnly = true;
|
||||
defaultText = lib.literalExpression "config.build.packageUnchecked";
|
||||
apply =
|
||||
let
|
||||
assertions = builtins.concatMap (x: lib.optional (!x.assertion) x.message) config.assertions;
|
||||
in
|
||||
if assertions != [ ] then
|
||||
throw "\nFailed assertions:\n${lib.concatMapStringsSep "\n" (msg: "- ${msg}") assertions}"
|
||||
else
|
||||
lib.showWarnings config.warnings;
|
||||
};
|
||||
|
||||
packageUnchecked = mkOption {
|
||||
type = types.package;
|
||||
description = ''
|
||||
Wrapped Neovim (without checking warnings or assertions).
|
||||
'';
|
||||
readOnly = true;
|
||||
};
|
||||
|
||||
|
@ -317,7 +340,8 @@ in
|
|||
in
|
||||
{
|
||||
build = {
|
||||
package = wrappedNeovim;
|
||||
package = config.build.packageUnchecked;
|
||||
packageUnchecked = wrappedNeovim;
|
||||
inherit initFile initSource;
|
||||
|
||||
printInitPackage = pkgs.writeShellApplication {
|
||||
|
|
|
@ -9,7 +9,7 @@ let
|
|||
cfg = config.test;
|
||||
|
||||
inherit (config) warnings;
|
||||
assertions = lib.nixvim.modules.getAssertionMessages config.assertions;
|
||||
assertions = builtins.concatMap (x: lib.optional (!x.assertion) x.message) config.assertions;
|
||||
in
|
||||
{
|
||||
options.test = {
|
||||
|
@ -70,7 +70,7 @@ in
|
|||
build.test =
|
||||
pkgs.runCommandNoCCLocal cfg.name
|
||||
{
|
||||
nativeBuildInputs = [ config.build.package ];
|
||||
nativeBuildInputs = [ config.build.packageUnchecked ];
|
||||
|
||||
# Allow inspecting the test's module a little from the repl
|
||||
# e.g.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue