65101ed034
google-antigravity 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 in CI once upstream fontforge is fixed.
66 lines
1.9 KiB
Python
66 lines
1.9 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 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
|
|
run("nix --version")
|
|
run("uname -a")
|
|
run("df -h /nix 2>/dev/null || df -h /")
|
|
run("free -h")
|
|
|
|
# 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"]
|
|
|
|
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}")
|