add image for atticd

get name and tag from created image dynamically
This commit is contained in:
Pim Kunis 2024-04-27 00:06:41 +02:00
parent 5a7cb47dd4
commit e53fe6af29
4 changed files with 130 additions and 6 deletions

3
atticd.nix Normal file
View file

@ -0,0 +1,3 @@
{ flutils, attic, ... }: flutils.lib.eachDefaultSystem (system: {
packages.atticd = attic.packages.${system}.attic-server-image;
})

View file

@ -1,5 +1,27 @@
{ {
"nodes": { "nodes": {
"attic": {
"inputs": {
"crane": "crane",
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1711742460,
"narHash": "sha256-0O4v6e4a1toxXZ2gf5INhg4WPE5C5T+SVvsBt+45Mcc=",
"owner": "zhaofengli",
"repo": "attic",
"rev": "4dbdbee45728d8ce5788db6461aaaa89d98081f0",
"type": "github"
},
"original": {
"owner": "zhaofengli",
"repo": "attic",
"type": "github"
}
},
"blog-pim": { "blog-pim": {
"inputs": { "inputs": {
"flutils": "flutils", "flutils": "flutils",
@ -21,6 +43,58 @@
"url": "https://git.kun.is/home/blog-pim" "url": "https://git.kun.is/home/blog-pim"
} }
}, },
"crane": {
"inputs": {
"nixpkgs": [
"attic",
"nixpkgs"
]
},
"locked": {
"lastModified": 1702918879,
"narHash": "sha256-tWJqzajIvYcaRWxn+cLUB9L9Pv4dQ3Bfit/YjU5ze3g=",
"owner": "ipetkov",
"repo": "crane",
"rev": "7195c00c272fdd92fc74e7d5a0a2844b9fadb2fb",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flutils": { "flutils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@ -74,6 +148,38 @@
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1711401922,
"narHash": "sha256-QoQqXoj8ClGo0sqD/qWKFWezgEwUL0SUh37/vY2jNhc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "07262b18b97000d16a4bdb003418bd2fb067a932",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1711460390,
"narHash": "sha256-akSgjDZL6pVHEfSE6sz1DNSXuYX6hq+P/1Z5IoYWs7E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "44733514b72e732bd49f5511bd0203dea9b9a434",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1714076141, "lastModified": 1714076141,
"narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=", "narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=",
@ -91,10 +197,11 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"attic": "attic",
"blog-pim": "blog-pim", "blog-pim": "blog-pim",
"flutils": "flutils_2", "flutils": "flutils_2",
"nginx": "nginx", "nginx": "nginx",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs_2"
} }
}, },
"systems": { "systems": {

View file

@ -4,6 +4,7 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flutils.url = "github:numtide/flake-utils"; flutils.url = "github:numtide/flake-utils";
attic.url = "github:zhaofengli/attic";
nginx = { nginx = {
url = "github:nginx/nginx"; url = "github:nginx/nginx";
@ -19,5 +20,6 @@
outputs = { flutils, ... }@inputs: flutils.lib.meld inputs [ outputs = { flutils, ... }@inputs: flutils.lib.meld inputs [
./blog-pim.nix ./blog-pim.nix
./forgejo-nix-action.nix ./forgejo-nix-action.nix
./atticd.nix
]; ];
} }

View file

@ -3,9 +3,21 @@
set -euo pipefail set -euo pipefail
IFS=$'\n\t' IFS=$'\n\t'
BLOGPIMPATH=$(nix build .#packages.x86_64-linux.blog-pim --print-out-paths --no-link) SYSTEM=x86_64-linux
GITREV=$(git rev-parse HEAD)
docker load < $BLOGPIMPATH name="${1-}"
docker tag blog-pim:latest git.kun.is/home/blog-pim:$GITREV
docker push git.kun.is/home/blog-pim:$GITREV if [ -z "$name" ];
then
echo "Usage: $0 NAME"
exit 1
fi
imagename=$(nix eval --no-allow-dirty --raw .#packages.$SYSTEM.$name.imageName)
imagetag=$(nix eval --no-allow-dirty --raw .#packages.$SYSTEM.$name.imageTag)
image=$(nix build --no-allow-dirty .#packages.$SYSTEM.$name --print-out-paths --no-link)
gitrev=$(git rev-parse HEAD)
docker load < $image
docker tag $imagename:$imagetag git.kun.is/home/$name:$gitrev
docker push git.kun.is/home/$name:$gitrev