From 37cf74265639dfe35a29f8850fde46f22f2b2a07 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Thu, 6 Jul 2023 10:09:34 -0700 Subject: [PATCH] Try env-style settings --- action.yml | 101 ++++++++++------------------------------------------- 1 file changed, 18 insertions(+), 83 deletions(-) diff --git a/action.yml b/action.yml index 224a703..723602b 100644 --- a/action.yml +++ b/action.yml @@ -103,6 +103,24 @@ runs: steps: - name: Install Nix shell: bash + env: + NIX_INSTALLER_MODIFY_PROFILE: ${{ inputs.modify-profile }} + NIX_INSTALLER_NIX_BUILD_USER_COUNT: ${{ inputs.nix-build-user-count }} + NIX_INSTALLER_NIX_BUILD_USER_ID_BASE: ${{ inputs.nix-build-user-base }} + NIX_INSTALLER_NIX_BUILD_USER_PREFIX: ${{ inputs.nix-build-user-prefix }} + NIX_INSTALLER_NIX_BUILD_GROUP_ID: ${{ inputs.nix-build-group-id }} + NIX_INSTALLER_NIX_BUILD_GROUP_NAME: ${{ inputs.nix-build-group-name }} + NIX_INSTALLER_ENCRYPT: ${{ inputs.mac-encrypt }} + NIX_INSTALLER_CASE_SENSITIVE: ${{ inputs.mac-case-sensitive }} + NIX_INSTALLER_VOLUME_LABEL: ${{ inputs.mac-volume-label }} + NIX_INSTALLER_ROOT_DISK: ${{ inputs.mac-root-disk }} + NIX_INSTALLER_LOGGER: ${{ inputs.logger }} + NIX_INSTALLER_INIT: ${{ inputs.init }} + NIX_INSTALLER_START_DAEMON: ${{ inputs.start-daemon }} + NIX_INSTALLER_LOG_DIRECTIVES: ${{ inputs.log-directives }} + RUST_BACKTRACE: ${{ inputs.backtrace }} + NIX_INSTALLER_DIAGNOSTIC_ENDPOINT: ${{ inputs.diagnostic-endpoint }} + NIX_INSTALLER_NO_CONFIRM: true run: | if [ -f "/nix/receipt.json" ] && [ -f "/nix/nix-installer" ]; then if ([ -n "${{ inputs.nix-installer-revision }}" ] || [ -n "${{ inputs.nix-installer-branch }}" ]) && [ "${{ inputs.reinstall }}" != "true" ]; then @@ -133,36 +151,6 @@ runs: echo "sandbox = false" >> ${NIX_EXTRA_CONF_FILE} fi - if [ -n "${{ inputs.modify-profile }}" ]; then - export NIX_INSTALLER_MODIFY_PROFILE=${{ inputs.modify-profile }} - echo "Set NIX_INSTALLER_MODIFY_PROFILE=$NIX_INSTALLER_MODIFY_PROFILE" - fi - - if [ -n "${{ inputs.nix-build-user-count }}" ]; then - export NIX_INSTALLER_NIX_BUILD_USER_COUNT=${{ inputs.nix-build-user-count }} - echo "Set NIX_INSTALLER_NIX_BUILD_USER_COUNT=$NIX_INSTALLER_NIX_BUILD_USER_COUNT" - fi - - if [ -n "${{ inputs.nix-build-group-name }}" ]; then - export NIX_INSTALLER_NIX_BUILD_GROUP_NAME=${{ inputs.nix-build-group-name }} - echo "Set NIX_INSTALLER_NIX_BUILD_GROUP_NAME=$NIX_INSTALLER_NIX_BUILD_GROUP_NAME" - fi - - if [ -n "${{ inputs.nix-build-group-id }}" ]; then - export NIX_INSTALLER_NIX_BUILD_GROUP_ID=${{ inputs.nix-build-group-id }} - echo "Set NIX_INSTALLER_NIX_BUILD_GROUP_ID=$NIX_INSTALLER_NIX_BUILD_GROUP_ID" - fi - - if [ -n "${{ inputs.nix-build-user-prefix }}" ]; then - export NIX_INSTALLER_NIX_BUILD_USER_ID_BASE=${{ inputs.nix-build-user-prefix }} - echo "Set NIX_INSTALLER_NIX_BUILD_USER_ID_BASE=$NIX_INSTALLER_NIX_BUILD_USER_ID_BASE" - fi - - if [ -n "${{ inputs.nix-build-user-base }}" ]; then - export NIX_INSTALLER_NIX_BUILD_USER_PREFIX=${{ inputs.nix-build-user-base }} - echo "Set NIX_INSTALLER_NIX_BUILD_USER_PREFIX=$NIX_INSTALLER_NIX_BUILD_USER_PREFIX" - fi - if [ -n "${{ inputs.nix-package-url }}" ]; then export NIX_INSTALLER_NIX_PACKAGE_URL=${{ inputs.nix-package-url }} echo "Set NIX_INSTALLER_NIX_PACKAGE_URL=$NIX_INSTALLER_NIX_PACKAGE_URL" @@ -182,26 +170,6 @@ runs: echo "Set NIX_INSTALLER_EXTRA_CONF=$NIX_INSTALLER_EXTRA_CONF" fi - if [ -n "${{ inputs.mac-encrypt }}" ]; then - export NIX_INSTALLER_ENCRYPT=${{ inputs.mac-encrypt }} - echo "Set NIX_INSTALLER_ENCRYPT=$NIX_INSTALLER_ENCRYPT" - fi - - if [ -n "${{ inputs.mac-case-sensitive }}" ]; then - export NIX_INSTALLER_CASE_SENSITIVE=${{ inputs.mac-case-sensitive }} - echo "Set NIX_INSTALLER_CASE_SENSITIVE=$NIX_INSTALLER_CASE_SENSITIVE" - fi - - if [ -n "${{ inputs.mac-volume-label }}" ]; then - export NIX_INSTALLER_VOLUME_LABEL=${{ inputs.mac-volume-label }} - echo "Set NIX_INSTALLER_VOLUME_LABEL=$NIX_INSTALLER_VOLUME_LABEL" - fi - - if [ -n "${{ inputs.mac-root-disk }}" ]; then - export NIX_INSTALLER_ROOT_DISK=${{ inputs.mac-root-disk }} - echo "Set NIX_INSTALLER_ROOT_DISK=$NIX_INSTALLER_ROOT_DISK" - fi - if [ -n "${{ inputs.nix-installer-pr }}" ] && [ -n "${{ inputs.nix-installer-tag }}" ]; then echo "The nix-installer-pr and nix-installer-tag options conflict, please choose one" exit 1 @@ -278,39 +246,6 @@ runs: echo "Set NIX_INSTALLER_URL=$NIX_INSTALLER_URL" fi - if [ -n "${{ inputs.logger }}" ]; then - export NIX_INSTALLER_LOGGER=${{ inputs.logger }} - echo "Set NIX_INSTALLER_LOGGER=$NIX_INSTALLER_LOGGER" - fi - - if [ -n "${{ inputs.init }}" ]; then - export NIX_INSTALLER_INIT=${{ inputs.init }} - echo "Set NIX_INSTALLER_INIT=$NIX_INSTALLER_INIT" - fi - - if [ -n "${{ inputs.start-daemon }}" ]; then - export NIX_INSTALLER_START_DAEMON=${{ inputs.start-daemon }} - echo "Set NIX_INSTALLER_START_DAEMON=$NIX_INSTALLER_START_DAEMON" - fi - - if [ -n "${{ inputs.log-directives }}" ]; then - export NIX_INSTALLER_LOG_DIRECTIVES=${{ inputs.log-directives }} - echo "Set NIX_INSTALLER_LOG_DIRECTIVES=$NIX_INSTALLER_LOG_DIRECTIVES" - fi - - if [ -n "${{ inputs.backtrace }}" ]; then - export RUST_BACKTRACE=${{ inputs.backtrace }} - echo "Set RUST_BACKTRACE=$RUST_BACKTRACE" - fi - - if [ -n "${{ inputs.diagnostic-endpoint }}" ]; then - export NIX_INSTALLER_DIAGNOSTIC_ENDPOINT="${{ inputs.diagnostic-endpoint }}" - echo "Set NIX_INSTALLER_DIAGNOSTIC_ENDPOINT=$NIX_INSTALLER_DIAGNOSTIC_ENDPOINT" - fi - - export NIX_INSTALLER_NO_CONFIRM=true - echo "Set NIX_INSTALLER_NO_CONFIRM=$NIX_INSTALLER_NO_CONFIRM" - if [ "${RUNNER_OS}" == "Linux" ]; then export PLANNER="linux" elif [ "${RUNNER_OS}" == "macOS" ]; then