forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_nix.sh
More file actions
executable file
·34 lines (29 loc) · 865 Bytes
/
Copy pathinstall_nix.sh
File metadata and controls
executable file
·34 lines (29 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
set -euo pipefail
# Ensure nix is installed
if command -v nix > /dev/null; then
echo "Nix is already installed. Exiting."
exit 0
fi
case "$(uname -s)" in
Darwin)
echo "macOS detected"
echo "Installing using the Lix installer to allow for a clean uninstall"
curl -sSf -L https://install.lix.systems/lix | sh -s -- install
;;
Linux)
echo "linux detected"
echo "Installing using upstream Nix installer"
sh <(curl -L https://nixos.org/nix/install) --daemon
echo "Enabling flakes in user config..."
mkdir -p ~/.config/nix
if ! grep -q "experimental-features" ~/.config/nix/nix.conf 2>/dev/null; then
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
fi
;;
*)
echo "Unsupported OS: $(uname -s)"
exit 1
;;
esac
echo "Nix installation complete."