Merge pull request 'install.sh: improvements' (#1500) from DavHau-install-dev into main

This commit is contained in:
clan-bot
2024-05-29 18:03:50 +00:00

View File

@@ -8,8 +8,9 @@ clean_temp_dir() {
rm -rf "$temp_dir"
}
is_nix_installed() {
if [ -n "$(command -v nix)" ]; then
is_installed() {
name=$1
if [ -n "$(command -v "$name")" ]; then
return 0
else
return 1
@@ -17,9 +18,18 @@ is_nix_installed() {
}
install_nix() {
if is_installed curl; then
curl --proto '=https' --tlsv1.2 -sSf -L \
https://install.determinate.systems/nix \
> "$temp_dir"/install_nix.sh
elif is_installed wget; then
wget -qO- \
https://install.determinate.systems/nix \
> "$temp_dir"/install_nix.sh
else
echo "Either curl or wget is required to install Nix. Exiting."
exit 1
fi
NIX_INSTALLER_DIAGNOSTIC_ENDPOINT="" sh "$temp_dir"/install_nix.sh install
}
@@ -35,12 +45,13 @@ ask_then_install_nix() {
}
ensure_nix_installed() {
if ! is_nix_installed; then
if ! is_installed nix; then
ask_then_install_nix
fi
}
start_clan_gui() {
PATH="${PATH:+$PATH:}/nix/var/nix/profiles/default/bin" \
exec nix run \
https://git.clan.lol/clan/clan-core/archive/main.tar.gz#clan-vm-manager \
--no-accept-flake-config \