Remove code to prefetch Docker images
This commit is contained in:
parent
eb90e5d1bd
commit
553992ec2f
3 changed files with 2 additions and 113 deletions
|
@ -1,4 +1,4 @@
|
|||
{ self, inputs, pkgs, lib, config, globals, ... }:
|
||||
{ self, inputs, pkgs, lib, config, ... }:
|
||||
let
|
||||
cfg = config.lab.k3s;
|
||||
in
|
||||
|
@ -191,48 +191,6 @@ in
|
|||
'';
|
||||
}
|
||||
);
|
||||
|
||||
docker-images.text =
|
||||
let
|
||||
imageDefs = import "${self}/container-images.nix";
|
||||
|
||||
setupCommands = [
|
||||
"rm -rf ${self.globals.imageDir}"
|
||||
"mkdir -p ${self.globals.imageDir}"
|
||||
];
|
||||
|
||||
getDockerImageConfig = dockerImage:
|
||||
let
|
||||
configJson = pkgs.runCommand "config.json"
|
||||
{
|
||||
nativeBuildInputs = [ pkgs.skopeo pkgs.jq ];
|
||||
}
|
||||
''
|
||||
skopeo --tmpdir $TMPDIR --insecure-policy inspect docker-archive:${dockerImage} --config | jq '.config' > $out
|
||||
'';
|
||||
in
|
||||
builtins.fromJSON (builtins.readFile configJson);
|
||||
|
||||
imageDefToLinkCommand = name: imageDef:
|
||||
let
|
||||
dockerImage = pkgs.dockerTools.pullImage imageDef;
|
||||
nixSnapshotterImage = pkgs.nix-snapshotter.buildImage {
|
||||
inherit name;
|
||||
resolvedByNix = true;
|
||||
fromImage = dockerImage;
|
||||
config = getDockerImageConfig dockerImage;
|
||||
};
|
||||
imageLinkPath = "${self.globals.imageDir}/${name}.tar";
|
||||
in
|
||||
"ln -sf ${nixSnapshotterImage} ${imageLinkPath}";
|
||||
|
||||
linkCommandList = lib.attrsets.mapAttrsToList imageDefToLinkCommand imageDefs;
|
||||
# TODO: Creating Docker images like this seems to *explode* in size.
|
||||
# Doing this for every image we currently have is infeasible.
|
||||
# I should investigate why the size increases like that.
|
||||
commandList = setupCommands; # ++ linkCommandList;
|
||||
in
|
||||
builtins.concatStringsSep "\n" commandList;
|
||||
};
|
||||
|
||||
sops.secrets =
|
||||
|
|
Reference in a new issue