jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
8.03k stars 210 forks source link

mise link doesn't seem to work #2289

Closed nickchomey closed 2 weeks ago

nickchomey commented 2 weeks ago

Describe the bug I am trying to symlink various binaries into mise, but keep getting an error message: No repository found for plugin ddev

It seems to happen for any binary that I try to link to.

To Reproduce mise ln ddev@apt /usr/bin/ddev --verbose (or any binary)

It creates a symlink (though shouldn't the directory structure be something like /mise/installs/ddev/apt/bin/ddev.binary rather than /mise/installs/ddev/apt.binary?)

nick@DESKTOP-DIFRTR1:~/.local/share/mise/installs/ddev$ ls -la
total 8
drwxr-xr-x  2 nick nick 4096 Jun 14 16:31 .
drwxr-xr-x 10 nick nick 4096 Jun 14 16:31 ..
lrwxrwxrwx  1 nick nick   13 Jun 14 16:31 apt -> /usr/bin/ddev

But it doesnt appear with mise ls

mise ls
Plugin                                Version                  Config Source              Requested
bun                                   1.1.12 (outdated)        ~/.config/mise/config.toml latest   
deno                                  1.44.0                                                       
deno                                  1.44.1                   ~/.config/mise/config.toml latest   
go                                    1.22.4                   ~/.config/mise/config.toml latest   
go:github.com/nats-io/nats-server/v2  2.10.17-RC.1 (outdated)  ~/.config/mise/config.toml latest   
go:github.com/nats-io/natscli/nats    0.1.3-2                                                      
go:github.com/nats-io/natscli/nats    0.1.3                    ~/.config/mise/config.toml 0.1.3    
go:github.com/nats-io/natscli/nats    0.1.4                                                        
rye                                   0.34.0                   ~/.config/mise/config.toml latest   
usage                                 0.3.0                    ~/.config/mise/config.toml latest 

And then it simply doesn't work when I try to mise use it

RUST_BACKTRACE=full mise use -g ddev@apt --verbose
[DEBUG] ARGS: /home/nick/.local/bin/mise use -g ddev@apt --verbose
[DEBUG] Config {
    Config Files: [
        "~/.config/mise/config.toml",
    ],
}
[DEBUG] Toolset (911.183µs): rye@latest, go@latest, go:github.com/nats-io/nats-server/v2@latest, usage@latest, bun@latest, go:github.com/nats-io/natscli/nats@0.1.3, deno@latest
[DEBUG] install_versions: ddev@apt
Error: 
   0: No repository found for plugin ddev

Location:
   src/backend/asdf.rs:107

Version:
   2024.6.3 linux-x64 (f01cc8d 2024-06-10)

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: color_eyre::config::EyreHook::into_eyre_hook::{{closure}}::hd20a3604cc145d9f
      at <unknown source file>:<unknown line>
   2: eyre::error::<impl eyre::Report>::from_adhoc::h4e5734d8ceb73c19
      at <unknown source file>:<unknown line>
   3: mise::backend::asdf::Asdf::get_repo_url::hb854b31a02d4f546
      at <unknown source file>:<unknown line>
   4: <mise::backend::asdf::Asdf as mise::backend::Backend>::ensure_installed::hb200c709bb929cad
      at <unknown source file>:<unknown line>
   5: mise::toolset::Toolset::install_versions::h6f46216ececc5eed
      at <unknown source file>:<unknown line>
   6: mise::cli::Commands::run::hd5767b0117d5c775
      at <unknown source file>:<unknown line>
   7: mise::cli::Cli::run::h999ae3717656a534
      at <unknown source file>:<unknown line>
   8: mise::main::hfd231697f1e30416
      at <unknown source file>:<unknown line>
   9: std::sys_common::backtrace::__rust_begin_short_backtrace::h07280f3ef69c46bc
      at <unknown source file>:<unknown line>
  10: main<unknown>
      at <unknown source file>:<unknown line>
  11: __libc_start_main<unknown>
      at <unknown source file>:<unknown line>
  12: _start<unknown>
      at <unknown source file>:<unknown line>

It seems like it is trying to use asdf plugins, but I have no idea why that would be the case

Expected behavior I would expect it to work

mise doctor output

version: 2024.6.3 linux-x64 (f01cc8d 2024-06-10)
activated: yes
shims_on_path: no

build_info: 
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Mon, 10 Jun 2024 15:39:58 +0000
  Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29)
  Profile: release

shell: 
  /bin/bash
  GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)
  Copyright (C) 2022 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

  This is free software; you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.

dirs: 
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/.cache/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files: 
  ~/.config/mise/config.toml

backends: 
  cargo
  core
  go
  npm
  pipx
  spm
  ubi

plugins: 
  bun     (core)
  deno    (core)
  erlang  (core)
  go      (core)
  java    (core)
  node    (core)
  python  (core)
  ruby    (core)
  rye     https://github.com/Azuki-bar/asdf-rye#024cc5f
  usage   https://github.com/jdx/mise-usage.git#fe3888a
  zig     (core)

toolset: 
  rye@0.34.0            
  go@1.22.4             
  go:github.com/nats-io/nats-server/v2@2.10.17-RC.1  
  usage@0.3.0           
  bun@1.1.12            
  go:github.com/nats-io/natscli/nats@0.1.3  
  deno@1.44.1           

env_vars: 
  MISE_USE_VERSIONS_HOST=true
  MISE_SHELL=bash

settings: 
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_tools = []
  experimental = true
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  http_timeout = 30
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "/home/nick/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

No warnings found
No problems found

**Additional context**
roele commented 2 weeks ago

AFAIK the link command is not meant to link binaries but tools. These tools usually come with a directory structure similar to the following, assuming a bin directory holding the binaries.

bin/
libs/
LICENSE
README

Regarding the syntax ddev@apt, mise is managing symlinks in the ~/.local/share/mise/installs directory respecting semantic versioning which makes it possible to have symlinks for major, minor and patch versions (e.g. 1, 1.1 and 1.1.0). Hence the expected <TOOL>@<VERSION> syntax.

The backends feature is probably closer to what you are trying to achieve.

nickchomey commented 2 weeks ago

Thank you for the clarification.

I don't see how a backend could be used here, since they seem to trigger, for example, a go build. This has its own build process via Makefile.

Might a generic external binary symlink mechanism like this be possible to add? I think it would be quite useful, and probably relatively easy to add as it would just be creating a symlink and whatever associated directory structure and metadata is required.

In fact, it could also be useful for doing local development of tools that would normally be installed via the registry.

It might also be worth improving the docs for the link command - they're very vague about what it does.

nickchomey commented 2 weeks ago

Ok, I've made a very kludgy solution to this.

I basically just copied the directory and .mise.backend.json structure for the go backend (probably could work with others as well).

image

contents of .mise.backend.json

{"id":"go:ddev","name":"ddev","backend_type":"go"}

image

I will probably just make a mise task for this, but it would be cool to have a built-in "local" backend. I'll open another issue for this