ci: set nix options through NIX_CONFIG
Some checks failed
Build and Deploy to Production / test (push) Failing after 15s
Build and Deploy to Production / build (push) Has been skipped
Build and Deploy to Production / deploy (push) Has been skipped

The runner mounts a persistent nix-store volume over /nix. The current
nixos/nix image makes /etc/nix/nix.conf a symlink into /nix/store, and
the volume does not hold that path, so the link dangles and appending
to it fails before checkout: "/etc/nix/nix.conf: No such file or
directory".

Pass the settings in NIX_CONFIG instead. Without a config file Nix also
falls back to build-users-group = nixbld, which the container lacks, so
set it empty and turn the sandbox off, as the image config does.

Assisted-by: Claude:opus-5-5
This commit is contained in:
Sergei Poljanski 2026-10-18 09:34:37 +04:00
commit 642bec845a
Signed by: asxpi
GPG key ID: 4F8851660FA4121B
2 changed files with 16 additions and 2 deletions

View file

@ -10,6 +10,14 @@ jobs:
# so a red suite blocks the build+deploy — Forgejo has no cross-workflow needs.
test:
runs-on: nix-latest
# Settings via env, not /etc/nix/nix.conf: in the image that is a
# symlink into /nix/store, which the runner's nix-store volume
# shadows, so it dangles once the image moves on.
env:
NIX_CONFIG: |
experimental-features = nix-command flakes
build-users-group =
sandbox = false
services:
postgres:
image: postgres:17-alpine
@ -20,7 +28,6 @@ jobs:
steps:
- name: Prepare container for actions
run: |
echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
# node for JS actions (checkout); git-minimal is already in the image
nix-env -iA nixpkgs.nodejs_22

View file

@ -10,6 +10,14 @@ on:
jobs:
test:
runs-on: nix-latest
# Settings via env, not /etc/nix/nix.conf: in the image that is a
# symlink into /nix/store, which the runner's nix-store volume
# shadows, so it dangles once the image moves on.
env:
NIX_CONFIG: |
experimental-features = nix-command flakes
build-users-group =
sandbox = false
services:
# CI stand-in for bin/test's ephemeral Postgres: the nix container runs
# as root and initdb refuses to run as root, so the DB lives in a
@ -26,7 +34,6 @@ jobs:
steps:
- name: Prepare container for actions
run: |
echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
# node for JS actions (checkout); git-minimal is already in the image
nix-env -iA nixpkgs.nodejs_22