Skip to content

Commit cbf4b16

Browse files
authored
Merge pull request #251 from cachix/fix-env
fix: set up the environment based on the installer shell scripts
2 parents a809471 + 29a4dac commit cbf4b16

5 files changed

Lines changed: 261 additions & 141 deletions

File tree

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Test Runner
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
runs-on:
7+
description: 'GitHub Actions runner to use (e.g., ubuntu-latest, macos-13)'
8+
required: true
9+
type: string
10+
system:
11+
description: 'Target system architecture (e.g., x86_64-linux, aarch64-darwin)'
12+
required: true
13+
type: string
14+
oldest_installer_version:
15+
description: 'Oldest supported Nix installer version to test (e.g., nix-2.8.0)'
16+
required: true
17+
type: string
18+
19+
env:
20+
nixpkgs_channel: nixpkgs=channel:nixos-25.05
21+
22+
jobs:
23+
simple-build:
24+
runs-on: ${{ inputs.runs-on }}
25+
steps:
26+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
27+
- name: Install Nix
28+
uses: ./
29+
with:
30+
nix_path: ${{ env.nixpkgs_channel }}
31+
- name: Test environment variables
32+
run: ./tests/test-env.sh
33+
- run: nix-env -iA cachix -f https://cachix.org/api/v1/install
34+
- run: cat /etc/nix/nix.conf
35+
# cachix should be available and be able to configure a cache
36+
- run: cachix use cachix
37+
- run: nix-build tests/test-build.nix
38+
39+
custom-nix-path:
40+
runs-on: ${{ inputs.runs-on }}
41+
steps:
42+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
43+
- name: Install Nix
44+
uses: ./
45+
with:
46+
nix_path: ${{ env.nixpkgs_channel }}
47+
- run: test $NIX_PATH == '${{ env.nixpkgs_channel }}'
48+
- run: nix-build tests/test-build.nix
49+
50+
extra-nix-config:
51+
runs-on: ${{ inputs.runs-on }}
52+
steps:
53+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
54+
- name: Install Nix
55+
uses: ./
56+
with:
57+
nix_path: ${{ env.nixpkgs_channel }}
58+
extra_nix_config: |
59+
sandbox = relaxed
60+
- run: cat /etc/nix/nix.conf
61+
- run: nix-build tests/test-build.nix --arg noChroot true
62+
63+
flakes:
64+
runs-on: ${{ inputs.runs-on }}
65+
steps:
66+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
67+
- name: Install Nix
68+
uses: ./
69+
- run: nix flake show github:NixOS/nixpkgs
70+
71+
latest-installer:
72+
runs-on: ${{ inputs.runs-on }}
73+
steps:
74+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
75+
- name: Run NAR server
76+
run: |
77+
curl --location https://github.com/cachix/nar-toolbox/releases/download/v0.1.0/nar-toolbox-${{ inputs.system }} -O
78+
chmod +x ./nar-toolbox-${{ inputs.system }}
79+
./nar-toolbox-${{ inputs.system }} serve https://cache.nixos.org &
80+
- name: Install Nix
81+
uses: ./
82+
with:
83+
nix_path: ${{ env.nixpkgs_channel }}
84+
install_url: https://hydra.nixos.org/job/nix/master/installerScript/latest-finished/download/1/install
85+
install_options: "--tarball-url-prefix http://localhost:8080"
86+
- run: nix-build tests/test-build.nix
87+
88+
oldest-supported-installer:
89+
runs-on: ${{ inputs.runs-on }}
90+
steps:
91+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
92+
- name: Install Nix
93+
uses: ./
94+
with:
95+
nix_path: ${{ env.nixpkgs_channel }}
96+
install_url: https://releases.nixos.org/nix/${{ inputs.oldest_installer_version }}/install
97+
- run: nix-build tests/test-build.nix

‎.github/workflows/test.yml‎

Lines changed: 27 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -10,143 +10,43 @@ env:
1010
nixpkgs_channel: nixpkgs=channel:nixos-25.05
1111

1212
jobs:
13-
simple-build:
14-
strategy:
15-
fail-fast: false
16-
matrix:
17-
os:
18-
- ubuntu-latest
19-
- ubuntu-24.04-arm
20-
- macos-latest
21-
- macos-13
22-
runs-on: ${{ matrix.os }}
23-
steps:
24-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25-
- name: Install Nix
26-
uses: ./
27-
with:
28-
nix_path: ${{ env.nixpkgs_channel }}
29-
- run: nix-env -iA cachix -f https://cachix.org/api/v1/install
30-
- run: cat /etc/nix/nix.conf
31-
# cachix should be available and be able to configure a cache
32-
- run: cachix use cachix
33-
- run: nix-build test.nix
34-
35-
custom-nix-path:
36-
strategy:
37-
fail-fast: false
38-
matrix:
39-
os:
40-
- ubuntu-latest
41-
- ubuntu-24.04-arm
42-
- macos-latest
43-
- macos-13
44-
runs-on: ${{ matrix.os }}
45-
steps:
46-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
47-
- name: Install Nix
48-
uses: ./
49-
with:
50-
nix_path: ${{ env.nixpkgs_channel }}
51-
- run: test $NIX_PATH == '${{ env.nixpkgs_channel }}'
52-
- run: nix-build test.nix
53-
54-
extra-nix-config:
55-
strategy:
56-
fail-fast: false
57-
matrix:
58-
os:
59-
- ubuntu-latest
60-
- ubuntu-24.04-arm
61-
- macos-latest
62-
- macos-13
63-
runs-on: ${{ matrix.os }}
64-
steps:
65-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
66-
- name: Install Nix
67-
uses: ./
68-
with:
69-
nix_path: ${{ env.nixpkgs_channel }}
70-
extra_nix_config: |
71-
sandbox = relaxed
72-
- run: cat /etc/nix/nix.conf
73-
- run: nix-build test.nix --arg noChroot true
74-
75-
flakes:
76-
strategy:
77-
fail-fast: false
78-
matrix:
79-
os:
80-
- ubuntu-latest
81-
- ubuntu-24.04-arm
82-
- macos-latest
83-
- macos-13
84-
runs-on: ${{ matrix.os }}
85-
steps:
86-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
87-
- name: Install Nix
88-
uses: ./
89-
- run: nix flake show github:NixOS/nixpkgs
90-
91-
latest-installer:
13+
test:
9214
strategy:
9315
fail-fast: false
9416
matrix:
9517
include:
96-
- os: ubuntu-latest
18+
- runs-on: ubuntu-latest
9719
system: x86_64-linux
98-
- os: ubuntu-24.04-arm
20+
oldest_installer_version: nix-2.8.0
21+
- runs-on: ubuntu-24.04-arm
9922
system: aarch64-linux
100-
- os: macos-latest
23+
oldest_installer_version: nix-2.8.0
24+
- runs-on: ubuntu-22.04
25+
system: x86_64-linux
26+
oldest_installer_version: nix-2.8.0
27+
- runs-on: macos-latest
10128
system: aarch64-darwin
102-
- os: macos-13
29+
oldest_installer_version: nix-2.18.6
30+
- runs-on: macos-26
31+
system: aarch64-darwin
32+
oldest_installer_version: nix-2.18.6
33+
- runs-on: macos-15
34+
system: aarch64-darwin
35+
oldest_installer_version: nix-2.18.6
36+
- runs-on: macos-14
37+
system: aarch64-darwin
38+
oldest_installer_version: nix-2.8.0
39+
- runs-on: macos-13
10340
system: x86_64-darwin
104-
runs-on: ${{ matrix.os }}
105-
steps:
106-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
107-
- name: Run NAR server
108-
run: |
109-
curl --location https://github.com/cachix/nar-toolbox/releases/download/v0.1.0/nar-toolbox-${{ matrix.system }} -O
110-
chmod +x ./nar-toolbox-${{ matrix.system }}
111-
./nar-toolbox-${{ matrix.system }} serve https://cache.nixos.org &
112-
- name: Install Nix
113-
uses: ./
114-
with:
115-
nix_path: ${{ env.nixpkgs_channel }}
116-
install_url: https://hydra.nixos.org/job/nix/master/installerScript/latest-finished/download/1/install
117-
install_options: "--tarball-url-prefix http://localhost:8080"
118-
- run: nix-build test.nix
119-
120-
oldest-supported-installer:
121-
strategy:
122-
fail-fast: false
123-
matrix:
124-
include:
125-
- os: ubuntu-latest
126-
installer_version: nix-2.8.0
127-
- os: ubuntu-24.04-arm
128-
installer_version: nix-2.8.0
129-
- os: macos-latest
130-
# macOS 15 Sequoia took over some of the ids previously used for _nixbld
131-
# 2.18.6 is the oldest version that was patched for this.
132-
installer_version: nix-2.18.6
133-
- os: macos-13
134-
installer_version: nix-2.8.0
135-
runs-on: ${{ matrix.os }}
136-
steps:
137-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
138-
- name: Install Nix
139-
uses: ./
140-
with:
141-
nix_path: ${{ env.nixpkgs_channel }}
142-
install_url: https://releases.nixos.org/nix/${{ matrix.installer_version }}/install
143-
- run: nix-build test.nix
41+
oldest_installer_version: nix-2.8.0
42+
uses: ./.github/workflows/test-per-system.yml
43+
with:
44+
runs-on: ${{ matrix.runs-on }}
45+
system: ${{ matrix.system }}
46+
oldest_installer_version: ${{ matrix.oldest_installer_version }}
14447

14548
act-support:
146-
strategy:
147-
matrix:
148-
os: [ubuntu-latest]
149-
runs-on: ${{ matrix.os }}
49+
runs-on: ubuntu-latest
15050
steps:
15151
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
15252
- run: curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash

0 commit comments

Comments
 (0)