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