From eb14d7aeec6f5db61422ba133c8a125a954ab406 Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Thu, 2 Mar 2023 14:00:15 -0800 Subject: [PATCH] writers.writeNginxConfig: use crossplane to test the output --- pkgs/build-support/writers/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/writers/default.nix b/pkgs/build-support/writers/default.nix index 88da1ca54a975..f601098da3d59 100644 --- a/pkgs/build-support/writers/default.nix +++ b/pkgs/build-support/writers/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, buildPackages, lib, stdenv, libiconv, mkNugetDeps, mkNugetSource, gixy }: +{ pkgs, config, buildPackages, lib, stdenv, libiconv, mkNugetDeps, mkNugetSource, gixy, crossplane, jq }: let aliases = if config.allowAliases then (import ./aliases.nix lib) else prev: {}; @@ -225,11 +225,12 @@ let writeNginxConfig = name: text: pkgs.runCommandLocal name { inherit text; passAsFile = [ "text" ]; - nativeBuildInputs = [ gixy ]; + nativeBuildInputs = [ gixy crossplane jq ]; } /* sh */ '' # nginx-config-formatter has an error - https://github.com/1connect/nginx-config-formatter/issues/16 awk -f ${awkFormatNginx} "$textPath" | sed '/^\s*$/d' > $out gixy $out + crossplane parse --single-file $out | jq '.status != "ok" and (.errors | map(.error) | join("\n") + "\n" | halt_error) // empty' ''; # writePerl takes a name an attributeset with libraries and some perl sourcecode and