Skip to content

Commit

Permalink
mise: Adopt mise-en-place; switch cargo-binstall
Browse files Browse the repository at this point in the history
Not quite ready yet, so we need workarounds for:
jdx/mise#2260
jdx/mise#2536
jdx/mise#2290
  • Loading branch information
liskin committed Sep 16, 2024
1 parent af9f5ca commit 977f90d
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 16 deletions.
7 changes: 4 additions & 3 deletions .bashrc.d/10_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ export PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
export PATH="$HOME"/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:"$PATH"
export PATH="$HOME"/.cargo/bin:"$PATH"
export PATH="$HOME"/.cabal/bin:"$PATH"
export PATH="$HOME"/.local/share/mise/shims:"$PATH"
export PATH="$HOME"/.local/bin:"$PATH"
export PATH="$HOME"/bin/.ext:"$PATH"
export PATH="$HOME"/bin/.ext-npm:"$PATH"
export PATH="$HOME"/bin/.untracked:"$PATH"
export PATH="$HOME"/bin/.aliases:"$PATH"
export PATH="$HOME"/bin:"$PATH"
export PATH="$HOME"/bin/.ext:"$PATH"
export PATH="$HOME"/bin/.ext-npm:"$PATH"
export PATH="$HOME"/.local/bin:"$PATH"

# manpath only
for manpath in "$HOME"/.local/share/man/.manpath/*; do
Expand Down
1 change: 1 addition & 0 deletions .config/git/ignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.envrc
.mise.local.toml
.stack-work/
node_modules/
Empty file added .config/mise/.gitignore
Empty file.
12 changes: 12 additions & 0 deletions .config/mise/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[settings]
experimental = true
not_found_auto_install = false
paranoid = true

[settings.status]
missing_tools = "always"
show_env = true

[tools]
"ubi:cargo-bins/cargo-binstall" = "v1.10.5"
usage = "0.3.1"
11 changes: 11 additions & 0 deletions .local/share/mise/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.PHONY: all
all: shims/cargo-binstall
mise install

# FIXME: workaround for https://github.com/jdx/mise/issues/2260
shims/cargo-binstall:
mise install ubi:cargo-bins/cargo-binstall

.PHONY: gc
gc:
mise prune
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ SUBDIRS_EXCLUDE := docs/resume-cv .xmonad-testing
## Invoke make for all subdirs with Makefiles
all: $(filter-out $(SUBDIRS_EXCLUDE),$(SUBDIRS))

.cargo/bin: bin/.ext
.rustup: bin/.ext
.cargo/bin: .local/share/mise
.local/share/mise: bin/.ext .rustup

## Invoke "make gc" in sub-Makefiles
gc: .cargo/bin%gc
gc: bin/.ext%gc
gc: bin/.ext-npm%gc
gc: src-elixir%gc
gc: .local/share/mise%gc

.PHONY: $(filter bootstrap.sh,$(MAKECMDGOALS))
all: bootstrap.sh
Expand Down
1 change: 0 additions & 1 deletion bin/.ext/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/.ext-*
/buildifier
/cargo-binstall
/ctlptl
/dive
/docker-buildx
Expand Down
10 changes: 0 additions & 10 deletions bin/.ext/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ all:
CURL := curl -LSsf

BUILDIFIER_VERSION := v7.1.2
CARGO_BINSTALL_VERSION := v1.10.2
CIRCLECI_CLI_VERSION := v0.1.30549
CTLPTL_VERSION := v0.8.32
DIVE_VERSION := v0.12.0
Expand All @@ -30,7 +29,6 @@ TZ_VERSION := v0.7.0
UBI_VERSION := v0.1.1

BUILDIFIER_GITHUB := bazelbuild/buildtools
CARGO_BINSTALL_GITHUB := cargo-bins/cargo-binstall
CIRCLECI_CLI_GITHUB := CircleCI-Public/circleci-cli
CTLPTL_GITHUB := tilt-dev/ctlptl
DIVE_GITHUB := wagoodman/dive
Expand Down Expand Up @@ -165,14 +163,6 @@ kind: | .ext-kind ; ln -fsT $| $@
$(CURL) -o $@ https://github.com/$(KIND_GITHUB)/releases/download/$(KIND_VERSION)/kind-linux-amd64
chmod +x $@

all: cargo-binstall
cargo-binstall: | .ext-cargo-binstall ; ln -fsT $|/$@ $@
.ext-cargo-binstall: .ext-cargo-binstall-$(CARGO_BINSTALL_VERSION) ; ln -fsT $< $@
.ext-cargo-binstall-$(CARGO_BINSTALL_VERSION):
mkdir -p $@
$(CURL) https://github.com/$(CARGO_BINSTALL_GITHUB)/releases/download/$(CARGO_BINSTALL_VERSION)/cargo-binstall-x86_64-unknown-linux-gnu.tgz \
| tar -x -z -C $@ cargo-binstall

all: fclones
fclones: | .ext-fclones ; ln -fsT $|/$@ $@
.ext-fclones: .ext-fclones-$(FCLONES_VERSION) ; ln -fsT $< $@
Expand Down
8 changes: 8 additions & 0 deletions bin/bwrap-home
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ else
bwrap_opts+=(--bind /tmp{,})
fi

orig_HOME="$HOME"
if [[ $home_tmpfs ]]; then
bwrap_opts+=(
--tmpfs "$HOME"
Expand All @@ -71,6 +72,13 @@ else
)
fi

if [[ "$HOME" != "$orig_HOME" ]]; then
bwrap_opts+=(
--ro-bind {"$orig_HOME","$HOME"}/.config/mise
--ro-bind {"$orig_HOME","$HOME"}/.local/share/mise
)
fi

(( $# )) || set -- bash

o exec bwrap \
Expand Down

0 comments on commit 977f90d

Please sign in to comment.