Set nix options through NIX_CONFIG in CI
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:
parent
d5b8f77e5c
commit
caaccfc3a4
2 changed files with 16 additions and 2 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue