fix: mechabellum: 413

This commit is contained in:
2026-06-07 23:14:14 +00:00
parent 129c82c863
commit f4a59ff117
4 changed files with 127 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
# Gitea runner Nix image
The repo-owned Nix-capable job image is built by the flake package
`gitea-runner-nix-image`.
```sh
nix build .#gitea-runner-nix-image
```
The package currently emits a Docker archive tagged:
```text
gitea-runner-nix-image:2026-06-07
```
After publishing to the internal registry, map the `nix` runner label to the
published, immutable image reference:
```text
nix:docker://gitea.hectic-lab.com/hectic-lab/gitea-runner-nix-image:2026-06-07
```
Task 7 should replace the tag-only reference with the published digest once the
image is pushed, for example
`gitea.hectic-lab.com/hectic-lab/gitea-runner-nix-image@sha256:<digest>`.
Keep `ubuntu-latest` on the `gitea/runner` default image unless a later runner
configuration task explicitly changes it. Only the `nix` label should select
this custom image.
## Image contents
The image includes `nix`, `git`, `bash`, `coreutils`, and `cacert`. Its
`/etc/nix/nix.conf` enables flakes and configures the repo substituters from the
top-level `flake.nix`:
```text
experimental-features = nix-command flakes
substituters = https://cache.nixos.org https://cache.hectic-lab.com/hectic
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gW4x6l1xP+GxgH0r7u+f6p1VFlr0= hectic:KMQsKow4SoA9K2vOJlOljmx7/Zpf91Yy+5qEtxDDCzA=
sandbox = false
```
No Gitea runner token, SSH key, SOPS key, kubeconfig, Hetzner token, or S3
credential belongs in this image. Runtime secrets stay with the Kubernetes
runner configuration and token-file mount contract.
+1
View File
@@ -37,6 +37,7 @@ in {
proxyPass = "http://${apiHost}:${builtins.toString apiPort}"; proxyPass = "http://${apiHost}:${builtins.toString apiPort}";
extraConfig = '' extraConfig = ''
proxy_http_version 1.1; proxy_http_version 1.1;
client_max_body_size 500M;
''; '';
}; };
+1
View File
@@ -142,6 +142,7 @@ in {
watch = pkgs.callPackage ./c/watch/default.nix {}; watch = pkgs.callPackage ./c/watch/default.nix {};
support-bot = pkgs.callPackage ./support-bot {}; support-bot = pkgs.callPackage ./support-bot {};
gitea-heatmap = pkgs.callPackage ./gitea {}; gitea-heatmap = pkgs.callPackage ./gitea {};
gitea-runner-nix-image = pkgs.callPackage ./gitea-runner-nix-image {};
nix-derivation-hash = pkgs.callPackage ./nix-derivation-hash {}; nix-derivation-hash = pkgs.callPackage ./nix-derivation-hash {};
"sentinèlla" = pkgs.callPackage (./. + "/sentinèlla") {}; "sentinèlla" = pkgs.callPackage (./. + "/sentinèlla") {};
deploy = pkgs.callPackage ./deploy { inherit inputs; }; deploy = pkgs.callPackage ./deploy { inherit inputs; };
@@ -0,0 +1,79 @@
{
bash,
cacert,
coreutils,
dockerTools,
git,
lib,
nix,
symlinkJoin,
}:
let
name = "gitea-runner-nix-image";
tag = "2026-06-07";
root = symlinkJoin {
name = "${name}-root";
paths = [
bash
cacert
coreutils
git
nix
];
};
in
dockerTools.buildLayeredImageWithNixDb {
inherit name tag;
contents = [ root ];
fakeRootCommands = ''
mkdir -p ./etc
cat > ./etc/passwd <<'EOF'
root:x:0:0:root:/root:/bin/bash
nobody:x:65534:65534:nobody:/var/empty:/bin/false
EOF
cat > ./etc/group <<'EOF'
root:x:0:
nixbld:x:30000:
nobody:x:65534:
EOF
for n in $(seq 1 10); do
echo "nixbld$n:x:$((30000 + n)):30000:Nix build user $n:/var/empty:/bin/false" >> ./etc/passwd
sed -i "s/^nixbld:x:30000:.*/&,nixbld$n/" ./etc/group
done
mkdir -p ./nix/var/nix/{gcroots,profiles,temproots,userpool,db}
mkdir -p ./nix/var/log/nix/drvs
chmod 1777 ./nix/var/nix/gcroots ./nix/var/nix/profiles
'';
extraCommands = ''
mkdir -p etc/nix root tmp
chmod 1777 tmp
cat > etc/nix/nix.conf <<'EOF'
experimental-features = nix-command flakes
substituters = https://cache.nixos.org https://cache.hectic-lab.com/hectic
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gW4x6l1xP+GxgH0r7u+f6p1VFlr0= hectic:KMQsKow4SoA9K2vOJlOljmx7/Zpf91Yy+5qEtxDDCzA=
sandbox = false
EOF
'';
config = {
Cmd = [ "${bash}/bin/bash" ];
Env = [
"HOME=/root"
"PATH=${lib.makeBinPath [ bash coreutils git nix ]}"
"SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt"
"NIX_SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt"
"USER=root"
];
Labels = {
"org.opencontainers.image.description" = "Nix-capable Gitea Actions job image";
"org.opencontainers.image.ref.name" = "${name}:${tag}";
"org.opencontainers.image.source" = "https://gitea.hectic-lab.com/hectic-lab/util.nix";
};
WorkingDir = "/workspace";
};
}