docker-images: simplify a bit by decompressing at push time

This avoids Nix finding store paths in the output (because they're hidden), and
thus adding weird extraneous dependencies to the closure.
This commit is contained in:
Luke Granger-Brown 2020-10-18 13:59:31 +00:00
parent 7b80b817dd
commit 38b2bb3516

View file

@ -13,12 +13,12 @@ let
"registry.apps.k8s.lukegb.tech/depotcron/update_nixpkgs:latest" = depot.ops.maint.update_nixpkgs; "registry.apps.k8s.lukegb.tech/depotcron/update_nixpkgs:latest" = depot.ops.maint.update_nixpkgs;
}; };
baseName = p: builtins.elemAt (builtins.match "^[a-z0-9]+-([^.]+).*$" (baseNameOf p)) 0;
crane = "${depot.nix.pkgs.crane}/bin/crane"; crane = "${depot.nix.pkgs.crane}/bin/crane";
decompress = drv: pkgs.runCommandNoCC "docker-image" {} ''
${pkgs.gzip}/bin/gunzip -c ${drv} > $out
'';
pushCommands = lib.mapAttrsToList (name: value: '' pushCommands = lib.mapAttrsToList (name: value: ''
${crane} push ${decompress value} ${name} ${pkgs.gzip}/bin/gunzip -c ${value} > /tmp/push.tar
${crane} push /tmp/push.tar ${name}
'') images; '') images;
authCommands = lib.mapAttrsToList (name: value: '' authCommands = lib.mapAttrsToList (name: value: ''