mirror of
https://github.com/DeterminateSystems/nix-installer-action.git
synced 2024-12-23 13:32:06 +01:00
Make the runner user trusted by default
Usually we want the runner user to be able to configure binary caches.
This commit is contained in:
parent
d5491adf01
commit
b7b7f9899e
1 changed files with 16 additions and 10 deletions
26
action.yml
26
action.yml
|
@ -13,6 +13,9 @@ inputs:
|
||||||
github-token:
|
github-token:
|
||||||
description: A GitHub Token for making authenticated requests (which have a higher rate-limit quota than unauthenticated requests)
|
description: A GitHub Token for making authenticated requests (which have a higher rate-limit quota than unauthenticated requests)
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
|
trust-runner-user:
|
||||||
|
description: Whether to make the runner user trusted by the Nix daemon
|
||||||
|
default: "true"
|
||||||
channels:
|
channels:
|
||||||
description: Channel(s) to add (eg `nixpkgs=https://nixos.org/channels/nixpkgs-unstable`)
|
description: Channel(s) to add (eg `nixpkgs=https://nixos.org/channels/nixpkgs-unstable`)
|
||||||
required: false
|
required: false
|
||||||
|
@ -160,18 +163,21 @@ runs:
|
||||||
echo "Set NIX_INSTALLER_NIX_PACKAGE_URL=$NIX_INSTALLER_NIX_PACKAGE_URL"
|
echo "Set NIX_INSTALLER_NIX_PACKAGE_URL=$NIX_INSTALLER_NIX_PACKAGE_URL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
NIX_EXTRA_CONF=""
|
||||||
|
NEWLINE='
|
||||||
|
'
|
||||||
if [ -n "${{ inputs.extra-conf }}" ]; then
|
if [ -n "${{ inputs.extra-conf }}" ]; then
|
||||||
if [ -n "${{ inputs.github-token }}" ]; then
|
NIX_EXTRA_CONF="${{ inputs.extra-conf }}"
|
||||||
export NIX_INSTALLER_EXTRA_CONF="${{ inputs.extra-conf }}access-tokens = github.com=${{ inputs.github-token }}"
|
fi
|
||||||
else
|
if [ -n "${{ inputs.github-token }}" ]; then
|
||||||
export NIX_INSTALLER_EXTRA_CONF="${{ inputs.extra-conf }}"
|
NIX_EXTRA_CONF="${NIX_EXTRA_CONF:+$NIX_EXTRA_CONF$NEWLINE}access-tokens = github.com=${{ inputs.github-token }}"
|
||||||
fi
|
fi
|
||||||
|
if [ "${{ inputs.trust-runner-user }}" == "true" ]; then
|
||||||
|
NIX_EXTRA_CONF="${NIX_EXTRA_CONF:+$NIX_EXTRA_CONF$NEWLINE}trusted-users = root $USER"
|
||||||
|
fi
|
||||||
|
if [ -n "$NIX_EXTRA_CONF" ]; then
|
||||||
|
export NIX_INSTALLER_EXTRA_CONF="$NIX_EXTRA_CONF"
|
||||||
echo "Set NIX_INSTALLER_EXTRA_CONF=$NIX_INSTALLER_EXTRA_CONF"
|
echo "Set NIX_INSTALLER_EXTRA_CONF=$NIX_INSTALLER_EXTRA_CONF"
|
||||||
else
|
|
||||||
if [ -n "${{ inputs.github-token }}" ]; then
|
|
||||||
export NIX_INSTALLER_EXTRA_CONF="access-tokens = github.com=${{ inputs.github-token }}"
|
|
||||||
echo "Set NIX_INSTALLER_EXTRA_CONF=$NIX_INSTALLER_EXTRA_CONF"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${{ inputs.mac-encrypt }}" ]; then
|
if [ -n "${{ inputs.mac-encrypt }}" ]; then
|
||||||
|
|
Loading…
Reference in a new issue