forked from clan/clan-core
install.sh: improvements
- use either curl or wget - add to PATH /nix/var/nix/profiles/default/bin
This commit is contained in:
parent
5945630870
commit
7cb8c114c2
@ -8,8 +8,9 @@ clean_temp_dir() {
|
|||||||
rm -rf "$temp_dir"
|
rm -rf "$temp_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
is_nix_installed() {
|
is_installed() {
|
||||||
if [ -n "$(command -v nix)" ]; then
|
name=$1
|
||||||
|
if [ -n "$(command -v "$name")" ]; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
@ -17,9 +18,18 @@ is_nix_installed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_nix() {
|
install_nix() {
|
||||||
curl --proto '=https' --tlsv1.2 -sSf -L \
|
if is_installed curl; then
|
||||||
https://install.determinate.systems/nix \
|
curl --proto '=https' --tlsv1.2 -sSf -L \
|
||||||
> "$temp_dir"/install_nix.sh
|
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
|
NIX_INSTALLER_DIAGNOSTIC_ENDPOINT="" sh "$temp_dir"/install_nix.sh install
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,16 +45,17 @@ ask_then_install_nix() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ensure_nix_installed() {
|
ensure_nix_installed() {
|
||||||
if ! is_nix_installed; then
|
if ! is_installed nix; then
|
||||||
ask_then_install_nix
|
ask_then_install_nix
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
start_clan_gui() {
|
start_clan_gui() {
|
||||||
exec nix run \
|
PATH="${PATH:+$PATH:}/nix/var/nix/profiles/default/bin" \
|
||||||
https://git.clan.lol/clan/clan-core/archive/main.tar.gz#clan-vm-manager \
|
exec nix run \
|
||||||
--no-accept-flake-config \
|
https://git.clan.lol/clan/clan-core/archive/main.tar.gz#clan-vm-manager \
|
||||||
--extra-experimental-features flakes nix-command -- "$@"
|
--no-accept-flake-config \
|
||||||
|
--extra-experimental-features flakes nix-command -- "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user