Add experimental nix-snapshotter stuff
This commit is contained in:
parent
211caada8a
commit
c89209f1df
9 changed files with 55 additions and 32 deletions
|
@ -1,4 +1,4 @@
|
|||
{ inputs, pkgs, lib, config, ... }:
|
||||
{ self, inputs, pkgs, lib, config, ... }:
|
||||
let
|
||||
cfg = config.lab.k3s;
|
||||
|
||||
|
@ -167,9 +167,30 @@ in
|
|||
cp -f ${./k3s-ca/etcd/server-ca.crt} /var/lib/rancher/k3s/server/tls/etcd/server-ca.crt
|
||||
'';
|
||||
|
||||
nix-snapshotter-image = ''
|
||||
ln -sf ${image} /root/image.tar
|
||||
'';
|
||||
docker-images =
|
||||
let
|
||||
pulledImages = (import "${self}/container-images/pulled-images.nix") pkgs lib;
|
||||
basePath = "/var/docker_images";
|
||||
linesForImage = projectName: imageName: pulledImage:
|
||||
let
|
||||
projectPath = "${basePath}/${projectName}";
|
||||
in
|
||||
''
|
||||
mkdir -p ${projectPath}
|
||||
ln -sf ${pulledImage} ${projectPath}/${imageName}.tar
|
||||
'';
|
||||
linesForProject = projectName: project:
|
||||
let
|
||||
lines = lib.attrsets.mapAttrsToList (linesForImage projectName) project;
|
||||
in
|
||||
builtins.concatStringsSep "\n" lines;
|
||||
generateLines = projects:
|
||||
let
|
||||
lines = lib.attrsets.mapAttrsToList linesForProject projects;
|
||||
in
|
||||
builtins.concatStringsSep "\n" lines;
|
||||
in
|
||||
generateLines pulledImages;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Reference in a new issue