Add reinstall option

This commit is contained in:
Ana Hobden 2023-01-13 12:09:36 -08:00
parent b2d55a56d7
commit f0508f0de8
2 changed files with 43 additions and 1 deletions

View file

@ -36,6 +36,21 @@ jobs:
run: nix-instantiate -E 'builtins.currentTime' --eval
if: success() || failure()
shell: sh -l {0}
- name: Install Nix again (noop)
uses: ./
with:
logger: pretty
log-directives: nix_installer=trace
backtrace: full
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Reinstall Nix
uses: ./
with:
logger: pretty
log-directives: nix_installer=trace
backtrace: full
github-token: ${{ secrets.GITHUB_TOKEN }}
reinstall: true
run-x86_64-darwin:
name: Run x86_64 Darwin
@ -71,4 +86,19 @@ jobs:
run: nix-instantiate -E 'builtins.currentTime' --eval
if: success() || failure()
shell: zsh --login --interactive {0}
- name: Install Nix again (noop)
uses: ./
with:
logger: pretty
log-directives: nix_installer=trace
backtrace: full
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Reinstall Nix
uses: ./
with:
logger: pretty
log-directives: nix_installer=trace
backtrace: full
github-token: ${{ secrets.GITHUB_TOKEN }}
reinstall: true

View file

@ -2,7 +2,7 @@ name: Nix Installer
branding:
icon: 'box'
color: 'purple'
description: An experimental Nix installer using `nix-install`
description: Install Nix
inputs:
planner:
description: A planner to use
@ -75,6 +75,8 @@ inputs:
nix-installer-branch:
description: The branch of `nix-installer` to use
required: false
reinstall:
description: Force a reinstall if the
runs:
using: composite
@ -82,6 +84,16 @@ runs:
- name: Install Nix
shell: bash
run: |
if [ -f "/nix/receipt.json" ]; then
if [ -n "${{ inputs.reinstall }}" ]; then
/nix/nix-installer uninstall --no-confirm
else
echo "Nix was already installed, using existing install"
exit 0
fi
fi
if [ -n "${{ inputs.nix-installer-tag }}" ]; then
export NIX_INSTALLER_TAG=${{ inputs.tag }}
echo "Set NIX_INSTALLER_TAG=$NIX_INSTALLER_TAG"