make JSON writing optional

allow to pass `writeJSON = false;` and get the raw data instead. This is
useful if one wants to avoid writing secrets in the /nix/store. Instead,
use `nix-instantiate --strict --eval --json`.
This commit is contained in:
zimbatm 2019-02-07 23:58:55 +01:00
parent e63348ba97
commit 56d783f547
No known key found for this signature in database
GPG key ID: 71BAF6D40C1D63D7

View file

@ -47,7 +47,8 @@ let
buildResources = {
configuration ? {},
resourceFilter ? groupName: name: resource: true,
withDependencies ? true
withDependencies ? true,
writeJSON ? true
}: let
evaldConfiguration = evalKubernetesModules configuration;
@ -96,7 +97,12 @@ let
metadata.labels."kubenix/build" = listHash;
}) kubernetesList.items;
};
in pkgs.writeText "resources.json" (builtins.toJSON hashedList);
result = if writeJSON then
pkgs.writeText "resources.json" (builtins.toJSON hashedList)
else hashedList;
in
result;
buildTest = test: version: buildResources {
configuration = {