cf54f1c94f
Add the renamed gitea-local-fork derivation to the Woodpecker build matrix on x86_64 and aarch64 (the only platforms the derivation supports — see flake.nix). Resulting closure is pushed to attic-infra-cache-k3s-1 so subsequent `just gitea-run` invocations resolve from cache rather than recompile Go 1.26.3 locally.
79 lines
2.4 KiB
Python
79 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
"""Build all flake-hub packages and push to attic."""
|
|
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
def run(cmd):
|
|
print(f"+ {cmd}", flush=True)
|
|
r = subprocess.run(cmd, shell=True)
|
|
if r.returncode != 0:
|
|
sys.exit(r.returncode)
|
|
|
|
|
|
def info(cmd):
|
|
"""Like run(), but tolerant of failure — for non-load-bearing diagnostics."""
|
|
print(f"+ {cmd}", flush=True)
|
|
subprocess.run(cmd, shell=True)
|
|
|
|
|
|
def build(cmd):
|
|
"""Run a `nix build`, streaming stderr live; return stdout (the out path)."""
|
|
print(f"+ {cmd}", flush=True)
|
|
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, text=True)
|
|
out, _ = proc.communicate()
|
|
if proc.returncode != 0:
|
|
sys.exit(proc.returncode)
|
|
return out.strip()
|
|
|
|
|
|
ARCH = sys.argv[1]
|
|
ATTIC_CACHE = "attic-infra-cache-k3s-1"
|
|
ATTIC_SERVER = "https://nix-cache-upload.oleks.space"
|
|
ATTIC_TOKEN = os.environ["ATTIC_TOKEN"]
|
|
|
|
print(f"=== Building flake-hub packages for {ARCH} ===")
|
|
|
|
# Environment context for log readers
|
|
info("nix --version")
|
|
info("uname -a")
|
|
info("df -h /nix 2>/dev/null || df -h /")
|
|
info("cat /proc/meminfo | head -3")
|
|
|
|
# Setup attic
|
|
attic = (
|
|
build(
|
|
"nix build --inputs-from . nixpkgs#attic-client --print-build-logs --print-out-paths --no-link"
|
|
)
|
|
+ "/bin/attic"
|
|
)
|
|
run(f"'{attic}' login ci {ATTIC_SERVER} '{ATTIC_TOKEN}'")
|
|
|
|
# Packages per arch
|
|
packages = ["hello-world", "geesefs", "xonsh"]
|
|
# google-antigravity{,-no-fhs} skipped in CI: pulls in google-chrome, which
|
|
# transitively builds liberation-fonts; fontforge segfaults while generating
|
|
# the .ttf files (pipeline #40). Package definitions stay in the flake for
|
|
# local builds — re-enable here once upstream fontforge is fixed.
|
|
# if ARCH == "x86_64-linux":
|
|
# packages += ["google-antigravity", "google-antigravity-no-fhs"]
|
|
if ARCH == "s390x-linux":
|
|
packages += ["attic-client"]
|
|
# gitea-local-fork: only defined for x86_64-linux and aarch64-linux (cgo+sqlite
|
|
# and pnpm don't cross-compile cleanly — see flake.nix). Slow build: Go 1.26.3
|
|
# compiles from source (~5-8 min cold) on the first push after a rev bump.
|
|
if ARCH in ("x86_64-linux", "aarch64-linux"):
|
|
packages += ["gitea-local-fork"]
|
|
|
|
print("Building packages...")
|
|
for pkg in packages:
|
|
print(f"--- {pkg} ---")
|
|
out = build(
|
|
f"nix build '.#packages.{ARCH}.{pkg}' --print-build-logs --print-out-paths --no-link"
|
|
)
|
|
run(f"'{attic}' push {ATTIC_CACHE} {out}")
|
|
|
|
print(f"Build completed for {ARCH}")
|