Merge pull request #7925 from cole-h/fixup-xdg-nix-env

Check if NIX_LINK_NEW exists instead of checking that NIX_LINK doesn't exist
This commit is contained in:
Eelco Dolstra 2023-03-01 23:01:42 +01:00 committed by GitHub
commit ffadc35df1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View file

@ -20,6 +20,8 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: cachix/install-nix-action@v19 - uses: cachix/install-nix-action@v19
with:
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
- run: echo CACHIX_NAME="$(echo $GITHUB_REPOSITORY-install-tests | tr "[A-Z]/" "[a-z]-")" >> $GITHUB_ENV - run: echo CACHIX_NAME="$(echo $GITHUB_REPOSITORY-install-tests | tr "[A-Z]/" "[a-z]-")" >> $GITHUB_ENV
- uses: cachix/cachix-action@v12 - uses: cachix/cachix-action@v12
if: needs.check_secrets.outputs.cachix == 'true' if: needs.check_secrets.outputs.cachix == 'true'
@ -59,6 +61,8 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- run: echo CACHIX_NAME="$(echo $GITHUB_REPOSITORY-install-tests | tr "[A-Z]/" "[a-z]-")" >> $GITHUB_ENV - run: echo CACHIX_NAME="$(echo $GITHUB_REPOSITORY-install-tests | tr "[A-Z]/" "[a-z]-")" >> $GITHUB_ENV
- uses: cachix/install-nix-action@v19 - uses: cachix/install-nix-action@v19
with:
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
- uses: cachix/cachix-action@v12 - uses: cachix/cachix-action@v12
with: with:
name: '${{ env.CACHIX_NAME }}' name: '${{ env.CACHIX_NAME }}'
@ -103,6 +107,8 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: cachix/install-nix-action@v19 - uses: cachix/install-nix-action@v19
with:
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
- run: echo CACHIX_NAME="$(echo $GITHUB_REPOSITORY-install-tests | tr "[A-Z]/" "[a-z]-")" >> $GITHUB_ENV - run: echo CACHIX_NAME="$(echo $GITHUB_REPOSITORY-install-tests | tr "[A-Z]/" "[a-z]-")" >> $GITHUB_ENV
- run: echo NIX_VERSION="$(nix --experimental-features 'nix-command flakes' eval .\#default.version | tr -d \")" >> $GITHUB_ENV - run: echo NIX_VERSION="$(nix --experimental-features 'nix-command flakes' eval .\#default.version | tr -d \")" >> $GITHUB_ENV
- uses: cachix/cachix-action@v12 - uses: cachix/cachix-action@v12

View file

@ -8,7 +8,7 @@ if [ -n "${XDG_STATE_HOME-}" ]; then
else else
NIX_LINK_NEW=$HOME/.local/state/nix/profile NIX_LINK_NEW=$HOME/.local/state/nix/profile
fi fi
if ! [ -e "$NIX_LINK" ]; then if [ -e "$NIX_LINK_NEW" ]; then
NIX_LINK="$NIX_LINK_NEW" NIX_LINK="$NIX_LINK_NEW"
else else
if [ -t 2 ] && [ -e "$NIX_LINK_NEW" ]; then if [ -t 2 ] && [ -e "$NIX_LINK_NEW" ]; then

View file

@ -8,7 +8,7 @@ if [ -n "$HOME" ] && [ -n "$USER" ]; then
else else
NIX_LINK_NEW="$HOME/.local/state/nix/profile" NIX_LINK_NEW="$HOME/.local/state/nix/profile"
fi fi
if ! [ -e "$NIX_LINK" ]; then if [ -e "$NIX_LINK_NEW" ]; then
NIX_LINK="$NIX_LINK_NEW" NIX_LINK="$NIX_LINK_NEW"
else else
if [ -t 2 ] && [ -e "$NIX_LINK_NEW" ]; then if [ -t 2 ] && [ -e "$NIX_LINK_NEW" ]; then