-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (54 loc) · 2.27 KB
/
nix-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# This is a basic workflow to help you get started with Actions
name: Nix Test
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: ["main"]
pull_request:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
tests:
runs-on: ${{ matrix.os.name }}
strategy:
matrix:
os:
- name: macos-15
arch: aarch64-darwin
- name: macos-14
arch: aarch64-darwin
- name: macos-13
arch: x86_64-darwin
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup
run: |
sed -i '' "s/defaultHostname/$(scutil --get LocalHostName)/g" nixos-config/flake.nix
sed -i '' "s/defaultSystem/${{matrix.os.arch}}/g" nixos-config/flake.nix
sed -i '' "s/defaultVersion/$(sw_vers --productVersion | cut -d. -f1)/g" nixos-config/flake.nix
sudo mv /etc/nix/nix.conf /etc/nix/nix.conf.before-nix-darwin
sudo mv /etc/shells /etc/shells.before-nix-darwin
sudo mv /opt/homebrew/Library/Taps /opt/homebrew/Library/Taps.before-nix-darwin || true
sudo mv /usr/local/Homebrew/Library/Taps /usr/local/Homebrew/Library/Taps.before-nix-darwin || true
brew unlink python@3.12
brew uninstall --ignore-dependencies --force openssl@1.1
brew uninstall --ignore-dependencies --force openssl@3
- name: Test - Nix Run
env:
NIX_CONFIG: "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}"
run: |
nix run nix-darwin --extra-experimental-features nix-command --extra-experimental-features flakes -- switch --flake ./nixos-config
- name: Test - Switch
# See https://github.com/actions/runner-images/issues/264
shell: zsh {0}
env:
NIX_CONFIG: "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}"
run: |
darwin-rebuild switch --flake ./nixos-config