From 56d783f547b155f19a31ab61e1ebb8ee276eb7d3 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Thu, 7 Feb 2019 23:58:55 +0100 Subject: [PATCH] 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`. --- default.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 5b2828f..09ef662 100644 --- a/default.nix +++ b/default.nix @@ -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 = {