-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
76 lines (73 loc) · 2.64 KB
/
action.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: 'nix-action'
description: 'Install nix and haqq caches'
inputs:
signingKey:
description: "haqq cachix key"
required: true
extraPullNames:
description: "comma-separated extra cachix caches"
required: false
useMagicNixCache:
description: "use DeterminateSystems's magic nix cache. If enabled, cachix is disabled"
required: false
default: true
useCacheNixAction:
description: "use nix-community/cache-nix-action"
required: false
default: false
installNix:
required: false
default: true
useCachix:
description: "Use cachix with haqq.cachix.org"
required: false
default: true
cacheKeyPostfix:
description: "cache-nix-action primary-key postfix"
required: false
default: ''
installDevenv:
description: "install devenv profile"
required: false
default: false
runs:
using: 'composite'
steps:
- uses: nixbuild/nix-quick-install-action@v28
if: ${{ inputs.installNix == 'true' && inputs.useCacheNixAction == 'true' }}
- uses: DeterminateSystems/nix-installer-action@v12
if: ${{ inputs.installNix == 'true' && inputs.useCacheNixAction != 'true' }}
- name: Setup cache-nix-action
if: ${{ inputs.useCacheNixAction == 'true' }}
uses: nix-community/cache-nix-action@v5
with:
primary-key: nix-${{ runner.os }}-${{ inputs.cacheKeyPostfix }}
# restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until Nix store size (in bytes) is at most this number
# before trying to save a new cache
gc-max-store-size-linux: 1073741824
# do purge caches
purge: true
# purge all versions of the cache
purge-prefixes: cache-${{ matrix.os }}-
# created more than this number of seconds ago relative to the start of the `Post Restore` phase
purge-created: 0
# except the version with the `primary-key`, if it exists
purge-primary-key: never
- name: Setup magic nix cache
if: ${{ inputs.useMagicNixCache == 'true' }}
uses: DeterminateSystems/magic-nix-cache-action@v7
with:
upstream-cache: https://haqq.cachix.org
- name: Setup cachix
if: ${{ inputs.useCachix == 'true' }}
uses: cachix/cachix-action@v15
with:
name: haqq
signingKey: ${{ inputs.signingKey }}
extraPullNames: ${{ inputs.extraPullNames }}
- name: Install devenv
if: ${{ inputs.installDevenv == 'true' }}
run: nix profile install --accept-flake-config --extra-substituters https://nix-community.cachix.org tarball+https://install.devenv.sh/latest
shell: bash