-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·89 lines (73 loc) · 2.5 KB
/
ci.yml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Build Nix envs
on:
pull_request:
paths:
- '**'
- '!**.md'
push:
paths:
- '**'
- '!**.md'
schedule:
- cron: '0 0 * * 0' # Every Sunday at midnight UTC
jobs:
build-macos-env:
name: Build/cache macOS Nix env
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v22
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Setup Cachix
uses: cachix/cachix-action@v12
with:
name: bsathvik
signingKey: ${{ secrets.CACHIX_SIGNING_KEY }}
- name: If scheduled, update inputs
if: ${{ github.event_name == 'schedule' && success() }}
run: |
nix flake update
- name: Build and switch to nix-darwin env
run: |
# Create /run directory
echo -e "run\tprivate/var/run" | sudo tee -a /etc/synthetic.conf >/dev/null
/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t &>/dev/null || true
# Prevent conflict between Cachix installed by workflow and the one installed in the config
nix-env --set-flag priority 1 cachix
# Build and switch to config
nix build --extra-experimental-features ca-derivations .#darwinConfigurations.githubCI.system
./result/sw/bin/darwin-rebuild switch --flake .#githubCI
- name: If scheduled, push commit with updated inputs
if: ${{ github.event_name == 'schedule' && success() }}
run: |
git config user.name github-actions
git config user.email [email protected]
git aa
git cm "Update inputs"
git push
build-linux-env:
name: Build/cache Linux Nix env
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v22
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Setup Cachix
uses: cachix/cachix-action@v12
with:
name: bsathvik
signingKey: ${{ secrets.CACHIX_SIGNING_KEY }}
- name: Build and switch to home-manager env
run: |
# Prevent conflict between Cachix installed by workflow and the one installed in the config
nix-env --set-flag priority 1 cachix
# Build and switch to home-manager env
nix build .#homeConfigurations.runner.activationPackage; ./result/activate