feat(docker): add update script for declared images
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-01-09 13:48:00 -05:00
parent 2330fe3104
commit 557f249ab1
2 changed files with 29 additions and 2 deletions

View file

@ -14,6 +14,33 @@ in {
users.extraUsers.${mainUser}.extraGroups = ["docker"]; users.extraUsers.${mainUser}.extraGroups = ["docker"];
environment.systemPackages = with pkgs; [
nix-prefetch-docker
(writeShellScriptBin "updateImages" ''
pull() {
FILE="$1"
IMAGE=$(sed -n 's/.*imageName = "\([^"]*\).*/\1/p' "$FILE")
TAG=$(sed -n 's/.*finalImageTag = "\([^"]*\).*/\1/p' "$FILE")
echo "$IMAGE $TAG"
PREFETCH=$(nix-prefetch-docker "$IMAGE" "$TAG")
echo -e "pkgs:\npkgs.dockerTools.pullImage $PREFETCH" > "$FILE"
}
DIR="$1"
if [ -z "$DIR" ]; then
DIR="."
fi
IFS=$'\n'
for i in $(find "$DIR"/images -type f); do
pull "$i"
done
unset IFS
'')
];
services.borgbackup.configs.arion = { services.borgbackup.configs.arion = {
paths = [configPath]; paths = [configPath];

View file

@ -1,8 +1,8 @@
pkgs: pkgs:
pkgs.dockerTools.pullImage { pkgs.dockerTools.pullImage {
imageName = "vegardit/gitea-act-runner"; imageName = "vegardit/gitea-act-runner";
imageDigest = "sha256:b785240f713d93f4a2d2a82926eacd0ac1deeae360d8ddfbd456102850285efb"; imageDigest = "sha256:cebdf60a65a2bba2e3d59d906f65ee45c05643cb5ee74be4d2a73a93708084cd";
sha256 = "0z2vd663zyyfcz0rnl2ksivxmh63nhh4g42qx2idqb6j27s426bq"; sha256 = "1pfbad0k719s094qhmcy2kmnvsjvllzr19cnx5jlf9cfm9cglvr1";
finalImageName = "vegardit/gitea-act-runner"; finalImageName = "vegardit/gitea-act-runner";
finalImageTag = "dind-latest"; finalImageTag = "dind-latest";
} }