this repo has no description

bootstrap mise

altagos.dev 7602b918 05693ea2

verified
+348 -74
+9 -7
.tangled/workflows/build.yml
··· 9 9 nixpkgs: 10 10 - curl 11 11 - dart-sass 12 - - mise 13 12 - zip 14 13 15 14 environment: 16 15 ZIG_VERSION: "0.15.1" 17 16 18 17 steps: 19 - - name: Setup Zig 18 + - name: Setup mise 20 19 command: | 21 - mise trust 22 - mise doctor 23 - mise exec zig -- zig version 24 - MISE_VERBOSE=1 mise exec bun -- bun -v 20 + ./bin/mise install 21 + ./bin/mise trust 22 + ./bin/mise doctor 23 + - name: Setup Zig + Bun 24 + command: | 25 + ./bin/mise exec zig -- zig version 26 + ./bin/mise exec bun -- bun -v 25 27 - name: Download statichost cli 26 28 command: | 27 29 curl -so shcli https://www.statichost.eu/shcli 28 30 chmod +x shcli 29 31 - name: Build website 30 32 command: | 31 - mise dist 33 + ./bin/mise dist 32 34 - name: Upload 33 35 command: | 34 36 ./shcli altagos-dev ./zig-out/website
+339
bin/mise
··· 1 + #!/usr/bin/env bash 2 + set -eu 3 + 4 + __mise_bootstrap() { 5 + local script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 6 + local project_dir=$( cd -- "$( dirname -- "$script_dir" )" &> /dev/null && pwd ) 7 + export MISE_BOOTSTRAP_PROJECT_DIR="$project_dir" 8 + local localized_dir="$project_dir/.mise" 9 + export MISE_BOOTSTRAP_PROJECT_DIR="$project_dir" 10 + export MISE_DATA_DIR="$localized_dir" 11 + export MISE_CONFIG_DIR="$localized_dir" 12 + export MISE_CACHE_DIR="$localized_dir/cache" 13 + export MISE_STATE_DIR="$localized_dir/state" 14 + export MISE_INSTALL_PATH="$localized_dir/mise-2025.11.11" 15 + export MISE_TRUSTED_CONFIG_PATHS="$project_dir${MISE_TRUSTED_CONFIG_PATHS:+:$MISE_TRUSTED_CONFIG_PATHS}" 16 + export MISE_IGNORED_CONFIG_PATHS="$HOME/.config/mise${MISE_IGNORED_CONFIG_PATHS:+:$MISE_IGNORED_CONFIG_PATHS}" 17 + install() { 18 + #!/bin/sh 19 + set -eu 20 + 21 + #region logging setup 22 + if [ "${MISE_DEBUG-}" = "true" ] || [ "${MISE_DEBUG-}" = "1" ]; then 23 + debug() { 24 + echo "$@" >&2 25 + } 26 + else 27 + debug() { 28 + : 29 + } 30 + fi 31 + 32 + if [ "${MISE_QUIET-}" = "1" ] || [ "${MISE_QUIET-}" = "true" ]; then 33 + info() { 34 + : 35 + } 36 + else 37 + info() { 38 + echo "$@" >&2 39 + } 40 + fi 41 + 42 + error() { 43 + echo "$@" >&2 44 + exit 1 45 + } 46 + #endregion 47 + 48 + #region environment setup 49 + get_os() { 50 + os="$(uname -s)" 51 + if [ "$os" = Darwin ]; then 52 + echo "macos" 53 + elif [ "$os" = Linux ]; then 54 + echo "linux" 55 + else 56 + error "unsupported OS: $os" 57 + fi 58 + } 59 + 60 + get_arch() { 61 + musl="" 62 + if type ldd >/dev/null 2>/dev/null; then 63 + if [ "${MISE_INSTALL_MUSL-}" = "1" ] || [ "${MISE_INSTALL_MUSL-}" = "true" ]; then 64 + musl="-musl" 65 + elif [ "$(uname -o)" = "Android" ]; then 66 + # Android (Termux) always uses musl 67 + musl="-musl" 68 + else 69 + libc=$(ldd /bin/ls | grep 'musl' | head -1 | cut -d ' ' -f1) 70 + if [ -n "$libc" ]; then 71 + musl="-musl" 72 + fi 73 + fi 74 + fi 75 + arch="$(uname -m)" 76 + if [ "$arch" = x86_64 ]; then 77 + echo "x64$musl" 78 + elif [ "$arch" = aarch64 ] || [ "$arch" = arm64 ]; then 79 + echo "arm64$musl" 80 + elif [ "$arch" = armv7l ]; then 81 + echo "armv7$musl" 82 + else 83 + error "unsupported architecture: $arch" 84 + fi 85 + } 86 + 87 + get_ext() { 88 + if [ -n "${MISE_INSTALL_EXT:-}" ]; then 89 + echo "$MISE_INSTALL_EXT" 90 + elif [ -n "${MISE_VERSION:-}" ] && echo "$MISE_VERSION" | grep -q '^v2024'; then 91 + # 2024 versions don't have zstd tarballs 92 + echo "tar.gz" 93 + elif tar_supports_zstd; then 94 + echo "tar.zst" 95 + elif command -v zstd >/dev/null 2>&1; then 96 + echo "tar.zst" 97 + else 98 + echo "tar.gz" 99 + fi 100 + } 101 + 102 + tar_supports_zstd() { 103 + # tar is bsdtar or version is >= 1.31 104 + if tar --version | grep -q 'bsdtar' && command -v zstd >/dev/null 2>&1; then 105 + true 106 + elif tar --version | grep -q '1\.(3[1-9]|[4-9][0-9]'; then 107 + true 108 + else 109 + false 110 + fi 111 + } 112 + 113 + shasum_bin() { 114 + if command -v shasum >/dev/null 2>&1; then 115 + echo "shasum" 116 + elif command -v sha256sum >/dev/null 2>&1; then 117 + echo "sha256sum" 118 + else 119 + error "mise install requires shasum or sha256sum but neither is installed. Aborting." 120 + fi 121 + } 122 + 123 + get_checksum() { 124 + version=$1 125 + os=$2 126 + arch=$3 127 + ext=$4 128 + url="https://github.com/jdx/mise/releases/download/v${version}/SHASUMS256.txt" 129 + 130 + # For current version use static checksum otherwise 131 + # use checksum from releases 132 + if [ "$version" = "v2025.11.11" ]; then 133 + checksum_linux_x86_64="f1ba51b26998d5d75fe14c74e16f8a66a13bf2a403f5ca97e3efb1f952ee5bf7 ./mise-v2025.11.11-linux-x64.tar.gz" 134 + checksum_linux_x86_64_musl="b3d0ada98b5319ca9e1095d8761ab10c8854fdd5c7487e85cbb7e6972a69ffea ./mise-v2025.11.11-linux-x64-musl.tar.gz" 135 + checksum_linux_arm64="2d9e3e27da8323d331ed01c0424dfc282856c1124626eb3f1ad79a1588e33763 ./mise-v2025.11.11-linux-arm64.tar.gz" 136 + checksum_linux_arm64_musl="502059f4c449e7a18f4994ceba8c91c27f05364bb80b14c51f19be03a8f267d0 ./mise-v2025.11.11-linux-arm64-musl.tar.gz" 137 + checksum_linux_armv7="2be7aec10ec9a79fcede2b930fcfbf1a5e755900a4861c01ba4a3ceef2d516a8 ./mise-v2025.11.11-linux-armv7.tar.gz" 138 + checksum_linux_armv7_musl="293c94b0cedf2fb53c6fea7f7149e2217d53c0dddb6aea1692c56c6bbcb3159f ./mise-v2025.11.11-linux-armv7-musl.tar.gz" 139 + checksum_macos_x86_64="c64c00028db0bbb73d4a9801a2ecb68f9cf5927c4e53740871e5d7ba8ab0b3c7 ./mise-v2025.11.11-macos-x64.tar.gz" 140 + checksum_macos_arm64="afbf065a2759dcbee8fc56b7afa0324c5f76e09b7bac245284a5f8b8d4bb1d81 ./mise-v2025.11.11-macos-arm64.tar.gz" 141 + checksum_linux_x86_64_zstd="9fefbbef115f9dad3ed3068edd52bcdd27a04d4829a63d4917ddd20c14367c11 ./mise-v2025.11.11-linux-x64.tar.zst" 142 + checksum_linux_x86_64_musl_zstd="59e9267bb388784ff17dbf99104e1d8f03aaafae6e84e4eeb8437ebe683b27a3 ./mise-v2025.11.11-linux-x64-musl.tar.zst" 143 + checksum_linux_arm64_zstd="3d6242e5296292a1aa4d42cfd8631ef12a3cf9f3c7cc5eb39a102896d93e0784 ./mise-v2025.11.11-linux-arm64.tar.zst" 144 + checksum_linux_arm64_musl_zstd="2f4116d30bd99e3eb9b3fe949c02d46d99339d3e573bd824ecd0185a69367275 ./mise-v2025.11.11-linux-arm64-musl.tar.zst" 145 + checksum_linux_armv7_zstd="f00100833cc08aa854b2af77dd559191cc1c7d54a32ff8121170dbc8c965e62b ./mise-v2025.11.11-linux-armv7.tar.zst" 146 + checksum_linux_armv7_musl_zstd="96afb1ccc771b7310f870a1df7699f9601da0fe5083fbb0a0f760ecbe66a697c ./mise-v2025.11.11-linux-armv7-musl.tar.zst" 147 + checksum_macos_x86_64_zstd="f5ffcf4c2263bcdce78ae5344f4ccc4bbf0e93f7619799cac140079a50bbb37a ./mise-v2025.11.11-macos-x64.tar.zst" 148 + checksum_macos_arm64_zstd="c07ca98edb30062879b47e5eb46f31d86b71cbd88f62d3350236178e5a8552a9 ./mise-v2025.11.11-macos-arm64.tar.zst" 149 + 150 + # TODO: refactor this, it's a bit messy 151 + if [ "$ext" = "tar.zst" ]; then 152 + if [ "$os" = "linux" ]; then 153 + if [ "$arch" = "x64" ]; then 154 + echo "$checksum_linux_x86_64_zstd" 155 + elif [ "$arch" = "x64-musl" ]; then 156 + echo "$checksum_linux_x86_64_musl_zstd" 157 + elif [ "$arch" = "arm64" ]; then 158 + echo "$checksum_linux_arm64_zstd" 159 + elif [ "$arch" = "arm64-musl" ]; then 160 + echo "$checksum_linux_arm64_musl_zstd" 161 + elif [ "$arch" = "armv7" ]; then 162 + echo "$checksum_linux_armv7_zstd" 163 + elif [ "$arch" = "armv7-musl" ]; then 164 + echo "$checksum_linux_armv7_musl_zstd" 165 + else 166 + warn "no checksum for $os-$arch" 167 + fi 168 + elif [ "$os" = "macos" ]; then 169 + if [ "$arch" = "x64" ]; then 170 + echo "$checksum_macos_x86_64_zstd" 171 + elif [ "$arch" = "arm64" ]; then 172 + echo "$checksum_macos_arm64_zstd" 173 + else 174 + warn "no checksum for $os-$arch" 175 + fi 176 + else 177 + warn "no checksum for $os-$arch" 178 + fi 179 + else 180 + if [ "$os" = "linux" ]; then 181 + if [ "$arch" = "x64" ]; then 182 + echo "$checksum_linux_x86_64" 183 + elif [ "$arch" = "x64-musl" ]; then 184 + echo "$checksum_linux_x86_64_musl" 185 + elif [ "$arch" = "arm64" ]; then 186 + echo "$checksum_linux_arm64" 187 + elif [ "$arch" = "arm64-musl" ]; then 188 + echo "$checksum_linux_arm64_musl" 189 + elif [ "$arch" = "armv7" ]; then 190 + echo "$checksum_linux_armv7" 191 + elif [ "$arch" = "armv7-musl" ]; then 192 + echo "$checksum_linux_armv7_musl" 193 + else 194 + warn "no checksum for $os-$arch" 195 + fi 196 + elif [ "$os" = "macos" ]; then 197 + if [ "$arch" = "x64" ]; then 198 + echo "$checksum_macos_x86_64" 199 + elif [ "$arch" = "arm64" ]; then 200 + echo "$checksum_macos_arm64" 201 + else 202 + warn "no checksum for $os-$arch" 203 + fi 204 + else 205 + warn "no checksum for $os-$arch" 206 + fi 207 + fi 208 + else 209 + if command -v curl >/dev/null 2>&1; then 210 + debug ">" curl -fsSL "$url" 211 + checksums="$(curl --compressed -fsSL "$url")" 212 + else 213 + if command -v wget >/dev/null 2>&1; then 214 + debug ">" wget -qO - "$url" 215 + checksums="$(wget -qO - "$url")" 216 + else 217 + error "mise standalone install specific version requires curl or wget but neither is installed. Aborting." 218 + fi 219 + fi 220 + # TODO: verify with minisign or gpg if available 221 + 222 + checksum="$(echo "$checksums" | grep "$os-$arch.$ext")" 223 + if ! echo "$checksum" | grep -Eq "^([0-9a-f]{32}|[0-9a-f]{64})"; then 224 + warn "no checksum for mise $version and $os-$arch" 225 + else 226 + echo "$checksum" 227 + fi 228 + fi 229 + } 230 + 231 + #endregion 232 + 233 + download_file() { 234 + url="$1" 235 + download_dir="$2" 236 + filename="$(basename "$url")" 237 + file="$download_dir/$filename" 238 + 239 + info "mise: installing mise..." 240 + 241 + if command -v curl >/dev/null 2>&1; then 242 + debug ">" curl -#fLo "$file" "$url" 243 + curl -#fLo "$file" "$url" 244 + else 245 + if command -v wget >/dev/null 2>&1; then 246 + debug ">" wget -qO "$file" "$url" 247 + stderr=$(mktemp) 248 + wget -O "$file" "$url" >"$stderr" 2>&1 || error "wget failed: $(cat "$stderr")" 249 + rm "$stderr" 250 + else 251 + error "mise standalone install requires curl or wget but neither is installed. Aborting." 252 + fi 253 + fi 254 + 255 + echo "$file" 256 + } 257 + 258 + install_mise() { 259 + version="${MISE_VERSION:-v2025.11.11}" 260 + version="${version#v}" 261 + os="${MISE_INSTALL_OS:-$(get_os)}" 262 + arch="${MISE_INSTALL_ARCH:-$(get_arch)}" 263 + ext="${MISE_INSTALL_EXT:-$(get_ext)}" 264 + install_path="${MISE_INSTALL_PATH:-$HOME/.local/bin/mise}" 265 + install_dir="$(dirname "$install_path")" 266 + install_from_github="${MISE_INSTALL_FROM_GITHUB:-}" 267 + if [ "$version" != "v2025.11.11" ] || [ "$install_from_github" = "1" ] || [ "$install_from_github" = "true" ]; then 268 + tarball_url="https://github.com/jdx/mise/releases/download/v${version}/mise-v${version}-${os}-${arch}.${ext}" 269 + elif [ -n "${MISE_TARBALL_URL-}" ]; then 270 + tarball_url="$MISE_TARBALL_URL" 271 + else 272 + tarball_url="https://mise.jdx.dev/v${version}/mise-v${version}-${os}-${arch}.${ext}" 273 + fi 274 + 275 + download_dir="$(mktemp -d)" 276 + cache_file=$(download_file "$tarball_url" "$download_dir") 277 + debug "mise-setup: tarball=$cache_file" 278 + 279 + debug "validating checksum" 280 + cd "$(dirname "$cache_file")" && get_checksum "$version" "$os" "$arch" "$ext" | "$(shasum_bin)" -c >/dev/null 281 + 282 + # extract tarball 283 + mkdir -p "$install_dir" 284 + rm -rf "$install_path" 285 + extract_dir="$(mktemp -d)" 286 + cd "$extract_dir" 287 + if [ "$ext" = "tar.zst" ] && ! tar_supports_zstd; then 288 + zstd -d -c "$cache_file" | tar -xf - 289 + else 290 + tar -xf "$cache_file" 291 + fi 292 + mv mise/bin/mise "$install_path" 293 + 294 + # cleanup 295 + cd / # Move out of $extract_dir before removing it 296 + rm -rf "$download_dir" 297 + rm -rf "$extract_dir" 298 + 299 + info "mise: installed successfully to $install_path" 300 + } 301 + 302 + after_finish_help() { 303 + case "${SHELL:-}" in 304 + */zsh) 305 + info "mise: run the following to activate mise in your shell:" 306 + info "echo \"eval \\\"\\\$($install_path activate zsh)\\\"\" >> \"${ZDOTDIR-$HOME}/.zshrc\"" 307 + info "" 308 + info "mise: run \`mise doctor\` to verify this is setup correctly" 309 + ;; 310 + */bash) 311 + info "mise: run the following to activate mise in your shell:" 312 + info "echo \"eval \\\"\\\$($install_path activate bash)\\\"\" >> ~/.bashrc" 313 + info "" 314 + info "mise: run \`mise doctor\` to verify this is setup correctly" 315 + ;; 316 + */fish) 317 + info "mise: run the following to activate mise in your shell:" 318 + info "echo \"$install_path activate fish | source\" >> ~/.config/fish/config.fish" 319 + info "" 320 + info "mise: run \`mise doctor\` to verify this is setup correctly" 321 + ;; 322 + *) 323 + info "mise: run \`$install_path --help\` to get started" 324 + ;; 325 + esac 326 + } 327 + 328 + install_mise 329 + if [ "${MISE_INSTALL_HELP-}" != 0 ]; then 330 + after_finish_help 331 + fi 332 + 333 + cd "$MISE_BOOTSTRAP_PROJECT_DIR" 334 + } 335 + local MISE_INSTALL_HELP=0 336 + test -f "$MISE_INSTALL_PATH" || install 337 + } 338 + __mise_bootstrap 339 + exec "$MISE_INSTALL_PATH" "$@"
-3
zig/.gitignore
··· 1 - * 2 - !download.sh 3 - !.gitignore
-64
zig/download.sh
··· 1 - #!/usr/bin/env bash 2 - set -e 3 - 4 - [ -z "$ZIG_VERSION" ] && ZIG_VERSION="0.15.1" 5 - [ -z "$ZIG_PUBLIC_KEY" ] && ZIG_PUBLIC_KEY="RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U" 6 - 7 - command -v jq >/dev/null || { echo "jq required"; exit 1; } 8 - command -v minisign >/dev/null || { echo "minisign required"; exit 1; } 9 - 10 - # Clean up previous installation 11 - if [ -L "zig/zig" ]; then 12 - prev_dir=$(readlink zig/zig | cut -d '/' -f 2) 13 - [ -d "zig/$prev_dir" ] && rm -rf "zig/$prev_dir" 14 - rm -f "zig/zig" 15 - fi 16 - 17 - case "$(uname -s)" in 18 - Linux) 19 - case "$(uname -m)" in 20 - x86_64) p="x86_64-linux" ;; 21 - aarch64) p="aarch64-linux" ;; 22 - armv7l) p="arm-linux" ;; 23 - i686) p="x86-linux" ;; 24 - *) echo "Arch unsupported"; exit 1 ;; 25 - esac 26 - ;; 27 - Darwin) 28 - case "$(uname -m)" in 29 - x86_64) p="x86_64-macos" ;; 30 - arm64) p="aarch64-macos" ;; 31 - *) echo "Arch unsupported"; exit 1 ;; 32 - esac 33 - ;; 34 - *) echo "OS unsupported"; exit 1 ;; 35 - esac 36 - 37 - u=$(curl -s https://ziglang.org/download/index.json | jq -r ".\"$ZIG_VERSION\".\"$p\".tarball") 38 - [ -z "$u" ] && { echo "Version not found"; exit 1; } 39 - 40 - f=$(basename "$u") 41 - curl -sfL "$u" -o "zig/$f" || { echo "Download failed"; exit 1; } 42 - curl -sfL "$u.minisig" -o "zig/$f.minisig" || { echo "Sig download failed"; exit 1; } 43 - minisign -Vm "zig/$f" -P "$ZIG_PUBLIC_KEY" || { echo "Sig verification failed"; exit 1; } 44 - 45 - # Extract directly to zig folder 46 - if [[ "$f" == *.zip ]]; then 47 - unzip -q "zig/$f" -d zig 48 - else 49 - tar -xJf "zig/$f" --no-same-owner -C zig 50 - fi 51 - 52 - # Derive directory name 53 - d=$(echo "$f" | sed -E 's/\.(tar\.xz|tar\.gz|zip|tgz|tar)$//') 54 - 55 - # Verify binary exists 56 - [ ! -f "zig/$d/zig" ] && { echo "Binary not found"; exit 1; } 57 - 58 - # Create symlink with absolute paths 59 - ln -sf "$(pwd)/zig/$d/zig" "$(pwd)/zig/zig" 60 - 61 - # Cleanup 62 - rm -f "zig/$f" "zig/$f.minisig" 63 - 64 - echo "Zig installed successfully"