Skip to content

Commit b15708f

Browse files
authored
Merge pull request #152 from zimbatm/github-access-token
add github_access_token option
2 parents a590bb1 + c04fcbc commit b15708f

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

README.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ jobs:
5555
- uses: actions/checkout@v3
5656
- uses: cachix/install-nix-action@v18
5757
with:
58-
extra_nix_config: |
59-
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
58+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
6059
- run: nix build
6160
- run: nix flake check
6261
```
@@ -65,11 +64,15 @@ To install Nix from any commit, go to [the corresponding installer_test action](
6564
6665
## Inputs (specify using `with:`)
6766

67+
- `extra_nix_config`: append to `/etc/nix/nix.conf`
68+
69+
- `github_access_token`: configure nix to pull from github using the given github token. This helps work around rate limit issues.
70+
6871
- `install_url`: specify URL to install Nix from (useful for testing non-stable releases or pinning Nix for example https://releases.nixos.org/nix/nix-2.3.7/install)
6972

70-
- `nix_path`: set `NIX_PATH` environment variable, for example `nixpkgs=channel:nixos-unstable`
73+
- `install_options`: Additional installer flags passed to the installer script.
7174

72-
- `extra_nix_config`: append to `/etc/nix/nix.conf`
75+
- `nix_path`: set `NIX_PATH` environment variable, for example `nixpkgs=channel:nixos-unstable`
7376

7477
---
7578

action.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ name: 'Install Nix'
22
description: 'Installs Nix on GitHub Actions for the supported platforms: Linux and macOS.'
33
author: 'Domen Kožar'
44
inputs:
5+
extra_nix_config:
6+
description: 'Gets appended to `/etc/nix/nix.conf` if passed.'
7+
github_access_token:
8+
description: 'Configure nix to pull from github using the given github token.'
59
install_url:
610
description: 'Installation URL that will contain a script to install Nix.'
711
install_options:
812
description: 'Additional installer flags passed to the installer script.'
913
nix_path:
1014
description: 'Set NIX_PATH environment variable.'
11-
extra_nix_config:
12-
description: 'gets appended to `/etc/nix/nix.conf` if passed.'
1315
branding:
1416
color: 'blue'
1517
icon: 'sun'
@@ -19,7 +21,8 @@ runs:
1921
- run : ${{ github.action_path }}/install-nix.sh
2022
shell: bash
2123
env:
22-
INPUT_INSTALL_URL: ${{ inputs.install_url }}
24+
INPUT_EXTRA_NIX_CONFIG: ${{ inputs.extra_nix_config }}
25+
INPUT_GITHUB_ACCESS_TOKEN: ${{ inputs.github_access_token }}
2326
INPUT_INSTALL_OPTIONS: ${{ inputs.install_options }}
27+
INPUT_INSTALL_URL: ${{ inputs.install_url }}
2428
INPUT_NIX_PATH: ${{ inputs.nix_path }}
25-
INPUT_EXTRA_NIX_CONFIG: ${{ inputs.extra_nix_config }}

install-nix.sh

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ add_config() {
2121
add_config "max-jobs = auto"
2222
# Allow binary caches for user
2323
add_config "trusted-users = root $USER"
24+
# Add github access token
25+
if [[ $INPUT_GITHUB_ACCESS_TOKEN != "" ]]; then
26+
add_config "access-tokens" "github.com=$INPUT_GITHUB_ACCESS_TOKEN"
27+
fi
2428
# Append extra nix configuration if provided
2529
if [[ $INPUT_EXTRA_NIX_CONFIG != "" ]]; then
2630
add_config "$INPUT_EXTRA_NIX_CONFIG"

0 commit comments

Comments
 (0)