Skip to content

Commit 5a29177

Browse files
committed
fix: fail back to previous flake if upgrade fails
Signed-off-by: matttrach <matt.trachier@suse.com>
1 parent e58984f commit 5a29177

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.envrc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@ if ! which "$0" | grep -q nix; then
3636
git checkout flake.lock
3737
fi
3838

39-
print 'Installing Nix Profile...'
40-
nf profile install . --profile "$profile"
39+
echo 'Installing Nix Profile...'
40+
if ! nf profile install . --profile "$profile"; then
41+
echo 'Failed to install new Nix profile! Reverting to previous profile...'
42+
git checkout flake.lock
43+
nf profile install . --profile "$profile"
44+
fi
45+
4146
nf profile list --profile "$profile"
4247

4348
print 'Starting...'

0 commit comments

Comments
 (0)