2024-01-13 10:01:54 +00:00
|
|
|
use git.nu
|
2024-01-13 10:19:52 +00:00
|
|
|
use download.nu
|
2024-01-13 10:01:54 +00:00
|
|
|
|
|
|
|
def url_crystal [] {
|
|
|
|
let $ssha = sshagent_loaded
|
|
|
|
if $ssha {
|
|
|
|
return "git@github.com:freeflowuniverse/crystallib.git"
|
|
|
|
} else {
|
|
|
|
return "https://github.com/freeflowuniverse/crystallib"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export def clone_crystal [ --reset=false , --pull=false ] string {
|
|
|
|
let $url = url_crystal
|
2024-01-13 10:19:52 +00:00
|
|
|
let $r = git git_clone crystallib $url
|
2024-01-13 10:01:54 +00:00
|
|
|
return $r
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def url_mycelium [] string {
|
2024-01-13 10:19:52 +00:00
|
|
|
let $os = $nu.os-info.name
|
|
|
|
let $arch = $nu.os-info.arch
|
2024-01-13 10:01:54 +00:00
|
|
|
if $os == "macos" {
|
|
|
|
if $arch == "aarch64" {
|
|
|
|
return "https://github.com/threefoldtech/mycelium/releases/download/v0.2.3/mycelium-aarch64-apple-darwin.tar.gz"
|
|
|
|
} else if $arch == "x86_64" {
|
|
|
|
return "https://github.com/threefoldtech/mycelium/releases/download/v0.2.3/mycelium-x86_64-apple-darwin.tar.gz"
|
|
|
|
}
|
|
|
|
} else if $os == "linux" {
|
|
|
|
if $arch == "aarch64" {
|
|
|
|
return "https://github.com/threefoldtech/mycelium/releases/download/v0.2.3/mycelium-aarch64-unknown-linux-musl.tar.gz"
|
|
|
|
} else if $arch == "x86_64" {
|
|
|
|
return "https://github.com/threefoldtech/mycelium/releases/download/v0.2.3/mycelium-x86_64-unknown-linux-musl.tar.gz"
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
error make { msg: "only support darwin & linux" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-13 10:19:52 +00:00
|
|
|
export def install_mycelium [] {
|
2024-01-13 10:01:54 +00:00
|
|
|
let $name = "mycelium"
|
|
|
|
let tmppath = $"/tmp/($name)"
|
|
|
|
let $bin_dir = $"($env.BASE)/bin"
|
|
|
|
mkdir $bin_dir
|
|
|
|
let $url = url_mycelium
|
|
|
|
print $url
|
2024-01-13 10:19:52 +00:00
|
|
|
download download_expand $tmppath $"($url)" --minsize 2
|
|
|
|
mv -f $"($tmppath)/($name)" $"($bin_dir)/($name)"
|
2024-01-13 10:01:54 +00:00
|
|
|
chmod +x $"($bin_dir)/($name)"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def url_hero [] string {
|
2024-01-13 10:19:52 +00:00
|
|
|
let $os = $nu.os-info.name
|
|
|
|
let $arch = $nu.os-info.arch
|
2024-01-13 10:01:54 +00:00
|
|
|
if $os == "macos" {
|
|
|
|
if $arch == "aarch64" {
|
|
|
|
return "https://f003.backblazeb2.com/file/threefold/macos-arm64/hero"
|
|
|
|
} else if $arch == "x86_64" {
|
|
|
|
return "https://f003.backblazeb2.com/file/threefold/macos-i64/hero"
|
|
|
|
}
|
|
|
|
} else if $os == "linux" {
|
|
|
|
if $arch == "aarch64" {
|
|
|
|
error make { msg: "find url for hero on linux arm" }
|
|
|
|
} else if $arch == "x86_64" {
|
|
|
|
return "https://f003.backblazeb2.com/file/threefold/linux-i64/hero"
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
error make { msg: "only support darwin & linux" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-13 10:19:52 +00:00
|
|
|
export def install_hero [] {
|
2024-01-13 10:01:54 +00:00
|
|
|
let $name = "hero"
|
|
|
|
let $destpath = $"($env.BASE)/bin/hero"
|
|
|
|
let $url = url_hero
|
|
|
|
print $url
|
2024-01-13 10:19:52 +00:00
|
|
|
download download_do $destpath $"($url)" --minsize 4
|
2024-01-13 10:01:54 +00:00
|
|
|
chmod +x $destpath
|
|
|
|
}
|