Try writing to file

This commit is contained in:
Ana Hobden 2023-06-27 09:33:06 -07:00
parent 317936b794
commit e7cc0afd1d
2 changed files with 7 additions and 8 deletions

View file

@ -17,7 +17,7 @@ jobs:
logger: pretty logger: pretty
log-directives: nix_installer=trace log-directives: nix_installer=trace
backtrace: full backtrace: full
extra-conf: |- extra-conf: |
experimental-features = impure-derivations experimental-features = impure-derivations
- run: cat /etc/nix/nix.conf - run: cat /etc/nix/nix.conf
- name: echo $PATH - name: echo $PATH

View file

@ -159,20 +159,19 @@ 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="" NIX_EXTRA_CONF_FILE=/tmp/tmp.jvU0yFBwoanix-installer-extra-conf
NEWLINE='
'
if [ -n "${{ inputs.extra-conf }}" ]; then if [ -n "${{ inputs.extra-conf }}" ]; then
NIX_EXTRA_CONF="${{ inputs.extra-conf }}" echo "${{ inputs.extra-conf }}" | tee -a ${NIX_EXTRA_CONF_FILE}
fi fi
if [ -n "${{ inputs.github-token }}" ]; then if [ -n "${{ inputs.github-token }}" ]; then
NIX_EXTRA_CONF="${NIX_EXTRA_CONF:+$NIX_EXTRA_CONF$NEWLINE}access-tokens = github.com=${{ inputs.github-token }}" echo "access-tokens = github.com=${{ inputs.github-token }}" | tee -a ${NIX_EXTRA_CONF_FILE}
fi fi
if [ "${{ inputs.trust-runner-user }}" == "true" ]; then if [ "${{ inputs.trust-runner-user }}" == "true" ]; then
NIX_EXTRA_CONF="${NIX_EXTRA_CONF:+$NIX_EXTRA_CONF$NEWLINE}trusted-users = root $USER" echo "trusted-users = root $USER" | tee -a ${NIX_EXTRA_CONF_FILE}
fi fi
if [ -n "$NIX_EXTRA_CONF" ]; then if [ -n "$NIX_EXTRA_CONF" ]; then
export NIX_INSTALLER_EXTRA_CONF="$NIX_EXTRA_CONF" export NIX_INSTALLER_EXTRA_CONF="$(cat NIX_EXTRA_CONF_FILE")"
echo "Set NIX_INSTALLER_EXTRA_CONF=$NIX_INSTALLER_EXTRA_CONF" echo "Set NIX_INSTALLER_EXTRA_CONF=$NIX_INSTALLER_EXTRA_CONF"
fi fi