Skip to content

Commit 1f61722

Browse files
committed
Incorporate upstream changes from cachix/install-nix-action
See #33
1 parent ddbe7a4 commit 1f61722

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

action.yml

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ inputs:
77
runs:
88
using: 'node16'
99
main: 'dist/index.js'
10+
env:
11+
GITHUB_TOKEN: ${{ github.token }}

dist/install-nix.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ if ! type -p nix &>/dev/null ; then
1616
# Set jobs to number of cores
1717
add_config "max-jobs = auto"
1818
# Allow binary caches for user
19-
add_config "trusted-users = root $USER"
19+
add_config "trusted-users = root ${USER:-}"
20+
# Add github access token
21+
if [[ -n "${INPUT_GITHUB_ACCESS_TOKEN:-}" ]]; then
22+
add_config "access-tokens = github.com=$INPUT_GITHUB_ACCESS_TOKEN"
23+
elif [[ -n "${GITHUB_TOKEN:-}" ]]; then
24+
add_config "access-tokens = github.com=$GITHUB_TOKEN"
25+
fi
2026
# Append extra nix configuration if provided
2127

2228
# Nix installer flags
@@ -51,8 +57,9 @@ if ! type -p nix &>/dev/null ; then
5157
fi
5258

5359
# Set paths
54-
echo "/nix/var/nix/profiles/per-user/$USER/profile/bin" >> "$GITHUB_PATH"
5560
echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH"
61+
# new path for nix 2.14
62+
echo "$HOME/.nix-profile/bin" >> "$GITHUB_PATH"
5663

5764
export NIX_PATH=nixpkgs=channel:nixpkgs-unstable
5865
echo "NIX_PATH=${NIX_PATH}" >> $GITHUB_ENV

0 commit comments

Comments
 (0)