summary refs log tree commit diff
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2020-01-31 08:53:02 +0000
committeredef <edef@edef.eu>2020-02-05 01:59:09 +0000
commitb7641eaa5a689decfd3fc2c0e74d475eb20bbd64 (patch)
tree69ed28de44e24bd9b6133f640a1010cb3c0a1c7f
parentdbaafbbf73ef5aeb2fa7d5aea73bb32b9d78e4f3 (diff)
downloadnixpkgs-b7641eaa5a689decfd3fc2c0e74d475eb20bbd64.tar
nixpkgs-b7641eaa5a689decfd3fc2c0e74d475eb20bbd64.tar.gz
nixpkgs-b7641eaa5a689decfd3fc2c0e74d475eb20bbd64.tar.bz2
nixpkgs-b7641eaa5a689decfd3fc2c0e74d475eb20bbd64.tar.lz
nixpkgs-b7641eaa5a689decfd3fc2c0e74d475eb20bbd64.tar.xz
nixpkgs-b7641eaa5a689decfd3fc2c0e74d475eb20bbd64.tar.zst
nixpkgs-b7641eaa5a689decfd3fc2c0e74d475eb20bbd64.zip
google-cloud-sdk: compact all the JSON
This reduces output size by 20 MiB.
-rw-r--r--pkgs/tools/admin/google-cloud-sdk/default.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/pkgs/tools/admin/google-cloud-sdk/default.nix b/pkgs/tools/admin/google-cloud-sdk/default.nix
index fccd3d12acf..1a19d92984e 100644
--- a/pkgs/tools/admin/google-cloud-sdk/default.nix
+++ b/pkgs/tools/admin/google-cloud-sdk/default.nix
@@ -7,7 +7,7 @@
 #   3) used by `google-cloud-sdk` only on GCE guests
 #
 
-{ stdenv, lib, fetchurl, makeWrapper, python, openssl, with-gce ? false }:
+{ stdenv, lib, fetchurl, makeWrapper, python, openssl, jq, with-gce ? false }:
 
 let
   pythonEnv = python.withPackages (p: with p; [
@@ -38,6 +38,8 @@ in stdenv.mkDerivation rec {
 
   buildInputs = [ python makeWrapper ];
 
+  nativeBuildInputs = [ jq ];
+
   patches = [
     ./gcloud-path.patch
   ];
@@ -81,6 +83,12 @@ in stdenv.mkDerivation rec {
 
     # remove tests and test data
     find $out -name tests -type d -exec rm -rf '{}' +
+
+    # compact all the JSON
+    find $out -name \*.json | while read path; do
+      jq -c . $path > $path.min
+      mv $path.min $path
+    done
   '';
 
   meta = with stdenv.lib; {