Compare commits

..

2 Commits

Author SHA1 Message Date
Tom Alexander
affd4e61d6 auth
Some checks failed
build-staging Build build-staging has failed
2026-07-13 18:33:54 -04:00
Tom Alexander
40b81b715c Add support for building the site via nix. 2026-07-12 18:10:15 -04:00
2 changed files with 20 additions and 6 deletions

View File

@@ -108,10 +108,13 @@ spec:
script: | script: |
#!/usr/bin/env sh #!/usr/bin/env sh
set -euo pipefail set -euo pipefail
find /
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path) echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
workspaces: workspaces:
- name: repo - name: repo
workspace: git-source workspace: git-source
- name: nix-cache-creds
workspace: nix-cache-creds
runAfter: runAfter:
- fetch-repository - fetch-repository
- name: build-image - name: build-image
@@ -142,6 +145,9 @@ spec:
- "type=registry,ref=$(params.image-name):buildcache,mode=max,compression=zstd,compression-level=22,rewrite-timestamp=true,image-manifest=true,oci-mediatypes=true" - "type=registry,ref=$(params.image-name):buildcache,mode=max,compression=zstd,compression-level=22,rewrite-timestamp=true,image-manifest=true,oci-mediatypes=true"
- --opt - --opt
- build-arg:SOURCE_DATE_EPOCH=$(tasks.get-git-commit-time.results.unix-time) - build-arg:SOURCE_DATE_EPOCH=$(tasks.get-git-commit-time.results.unix-time)
# - --secret
# - id=cache_token,src=./my_local_token.txt
# - id=cache_token,env=MY_ENV_TOKEN
- name: BUILDKITD_TOML - name: BUILDKITD_TOML
value: | value: |
debug = true debug = true
@@ -155,6 +161,8 @@ spec:
workspace: git-source workspace: git-source
- name: dockerconfig - name: dockerconfig
workspace: docker-credentials workspace: docker-credentials
- name: nix-cache-creds
workspace: nix-cache-creds
runAfter: runAfter:
- fetch-repository - fetch-repository
finally: finally:
@@ -219,6 +227,7 @@ spec:
workspaces: workspaces:
- name: git-source - name: git-source
- name: docker-credentials - name: docker-credentials
- name: nix-cache-creds
workspaces: workspaces:
- name: git-source - name: git-source
volumeClaimTemplate: volumeClaimTemplate:
@@ -233,6 +242,9 @@ spec:
- name: docker-credentials - name: docker-credentials
secret: secret:
secretName: harbor-plain secretName: harbor-plain
- name: nix-cache-creds
secret:
secretName: nix-pull-through-cache
params: params:
- name: image-name - name: image-name
value: "harbor.fizz.buzz/private/homepage-staging" value: "harbor.fizz.buzz/private/homepage-staging"

View File

@@ -4,16 +4,18 @@
FROM nixos/nix:2.31.3 AS builder FROM nixos/nix:2.31.3 AS builder
#RUN cp "$(nix --extra-experimental-features "nix-command flakes" --option filter-syscalls false --option substituters "http://ncps.nix-pull-through-cache.svc.cluster.local:80 https://cache.nixos.org" build nixpkgs#cacert --print-out-paths)/etc/ssl/certs/ca-bundle.crt" /tmp/ca-bundle.crt RUN tee -a /etc/nix/nix.conf <<EOF
extra-experimental-features = nix-command flakes
filter-syscalls = false
substituters = http://ncps.nix-pull-through-cache.svc.cluster.local:80 https://cache.nixos.org
EOF
RUN --mount=type=secret,id=cache_token NIX_CONFIG="extra-access-tokens = ncps.nix-pull-through-cache.svc.cluster.local=$(cat /run/secrets/cache_token)" cp "$(nix build nixpkgs#cacert --print-out-paths)/etc/ssl/certs/ca-bundle.crt" /tmp/ca-bundle.crt
COPY . /tmp/build COPY . /tmp/build
WORKDIR /tmp/build WORKDIR /tmp/build
RUN nix \ RUN --mount=type=secret,id=cache_token NIX_CONFIG="extra-access-tokens = ncps.nix-pull-through-cache.svc.cluster.local=$(cat /run/secrets/cache_token)" nix build '.#docker_env'
--extra-experimental-features "nix-command flakes" \
--option filter-syscalls false \
--option substituters "http://ncps.nix-pull-through-cache.svc.cluster.local:80 https://cache.nixos.org" \
build '.#docker_env'
# Export the built closure to a folder # Export the built closure to a folder
RUN mkdir /tmp/nix-store-closure RUN mkdir /tmp/nix-store-closure