From dc25856d7469d8be2ff12a431cd11baedfee72d7 Mon Sep 17 00:00:00 2001 From: Tom Bereknyei Date: Wed, 18 Aug 2021 00:04:55 -0400 Subject: [PATCH] Ensure nix flake show produces valid json --- src/nix/flake-show.md | 3 +++ tests/flakes.sh | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/nix/flake-show.md b/src/nix/flake-show.md index 1a42c44a0..e484cf47e 100644 --- a/src/nix/flake-show.md +++ b/src/nix/flake-show.md @@ -35,4 +35,7 @@ specified by flake reference *flake-url*. These are the top-level attributes in the `outputs` of the flake, as well as lower-level attributes for some standard outputs (e.g. `packages` or `checks`). +With `--json`, the output is in a JSON representation suitable for automatic +processing by other tools. + )"" diff --git a/tests/flakes.sh b/tests/flakes.sh index 9e1b5b508..1bce4e4bd 100644 --- a/tests/flakes.sh +++ b/tests/flakes.sh @@ -386,12 +386,14 @@ git -C $templatesDir commit -m 'Initial' nix flake check templates nix flake show templates +nix flake show templates --json | jq (cd $flake7Dir && nix flake init) (cd $flake7Dir && nix flake init) # check idempotence git -C $flake7Dir add flake.nix nix flake check $flake7Dir nix flake show $flake7Dir +nix flake show $flake7Dir --json | jq git -C $flake7Dir commit -a -m 'Initial' # Test 'nix flake new'.