mise-nix icon indicating copy to clipboard operation
mise-nix copied to clipboard

nix-portable compatibility - not finding /nix

Open jcrben opened this issue 3 months ago • 5 comments

I'm using a Fedora Silverblue repository and it doesn't play nicely with nix.

As a result, I'm using https://github.com/DavHau/nix-portable - see https://universal-blue.discourse.group/t/nix-installation-is-gone-after-getting-fedora-42/8500/3?u=jcrben

As a result, mise install nix:[email protected] doesn't work.

➜  mise install nix:[email protected]
mise mise 2025.8.16 by @jdx – ░░░░░░░░░░░░░░░░░░░░ 0/1 
mise nix:[email protected] install                                                                                                                                                                             ⠁  0s🔨 Installing [email protected]...
mise mise 2025.8.16 by @jdx – ░░░░░░░░░░░░░░░░░░░░ 0/1 
mise nix:[email protected] install                                                                                                                                                                             ⠒ 19s⚠️ No binaries found. This package may be a library or data-only.
mise ERROR Failed to install tool: nix:[email protected]

nix:[email protected]: 
   0: failed to install nix:[email protected]
   1: Backend install method failed
   2: runtime error: ...iles/local/xdgdata/mise/plugins/nix/lib/platform.lua:125: Built package path does not exist: /nix/store/nndmy96lswhxc4xp49n950i1905qlfpy-hello-2.10
      stack traceback:
      	[C]: in function 'error'
      	...iles/local/xdgdata/mise/plugins/nix/lib/platform.lua:125: in function 'verify_build'
      	...files/local/xdgdata/mise/plugins/nix/lib/install.lua:59: in function 'from_nixhub'
      	...l/xdgdata/mise/plugins/nix/hooks/backend_install.lua:55: in function <...l/xdgdata/mise/plugins/nix/hooks/backend_install.lua:11>
      	(tail call): in function <(tail call):-1>

Location:
   src/backend/vfox.rs:113

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
mise ERROR Run with --verbose or MISE_VERBOSE=1 for more information
mise mise 2025.8.16 by @jdx – install                                                                                                                                                                   ⠐ 20s
ben in sync on  master [+] is 󰏗 v1.0.0 via  v18.20.8 took 19s 

jcrben avatar Sep 16 '25 05:09 jcrben

what version of the plugin are you using?

jbadeau avatar Sep 17 '25 11:09 jbadeau

It seems that it's a general nix issue. This plugin depends on a working setup. Can you pull use the package with raw nix? If not then mise-nix will not work either.

jbadeau avatar Sep 17 '25 11:09 jbadeau

https://github.com/cachix/devenv works well w/ nix-portable. I feel like it should be possible to support it

I expect it will work fine w/ raw nix, can try it with regular nix eventually but I'm not gonna use it that way since regular nix isn't compatible with Fedora Silverblue

nix-portable virtualizes /nix/store https://github.com/DavHau/nix-portable/blob/42803a3036650ad06dc4c341d2e402a8148513e8/default.nix#L281

~~May need to hook into the NP_RUNTIME=bwrap

I ran export NP_RUNTIME=bwrap and then tried it~~

Once I commented out https://github.com/jbadeau/mise-nix/blob/5c5496bcf9929a67425688fe2ad193d20d295dee/lib/platform.lua#L124-L126 it didn't spit out any errors

I found it inside ~/.nix-portable/nix/store but it failed:

cowsay failed with a similar message

ben in nix/store/nndmy96lswhxc4xp49n950i1905qlfpy-hello-2.10 
➜  ./bin/hello 
bash: ./bin/hello: cannot execute: required file not found
➜  strace ./bin/cowsay hmm
execve("./bin/cowsay", ["./bin/cowsay", "hmm"], 0x7ffcc22e1e68 /* 130 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++
➜  MISE_VERBOSE=1 mise install nix:[email protected]
DEBUG Version: 2025.8.16 linux-x64 (2025-08-21)
DEBUG ARGS: /home/ben/.local/bin/mise install nix:[email protected]
DEBUG config: /var/home/ben/mise.toml
DEBUG config: /var/home/ben/.config/mise/config.toml
INFO  mise 2025.8.16 by @jdx – install
DEBUG install_some_versions: nix:[email protected]
DEBUG Using backend method for plugin: nix
DEBUG [vfox:nix] backend_list_versions
DEBUG Getting metadata for nix
DEBUG starting new connection: https://www.nixhub.io/
INFO  nix:[email protected]  install
DEBUG [vfox:nix] backend_install
DEBUG Getting metadata for nix
🐛 Starting nixhub resolution for [email protected]
🐛 Version resolution took 1s
🔨 Installing [email protected]...
🐛 Starting nix build: nix build --no-link --print-out-paths "github:NixOS/nixpkgs/942b0817e898262cc6e3f0a5f706ce09d8f749f1#hello"
ℹ️ Resolving package...
🐛 Nix build took 0s
⚠️ No binaries found. This package may be a library or data-only.
💡 Using first available output for symlinking or build environment use.
Error: 
   0: Failed to install tool: nix:[email protected]

      nix:[email protected]: 
         0: failed to install nix:[email protected]
         1: Backend install method failed
         2: runtime error: ...iles/local/xdgdata/mise/plugins/nix/lib/platform.lua:125: Built package path does not exist: /nix/store/nndmy96lswhxc4xp49n950i1905qlfpy-hello-2.10
            stack traceback:
            	[C]: in function 'error'
            	...iles/local/xdgdata/mise/plugins/nix/lib/platform.lua:125: in function 'verify_build'
            	...files/local/xdgdata/mise/plugins/nix/lib/install.lua:59: in function 'from_nixhub'
            	...l/xdgdata/mise/plugins/nix/hooks/backend_install.lua:55: in function <...l/xdgdata/mise/plugins/nix/hooks/backend_install.lua:11>
            	(tail call): in function <(tail call):-1>

      Location:
         src/backend/vfox.rs:113

      Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
      Run with RUST_BACKTRACE=full to include source snippets.

Location:
   src/toolset/mod.rs:256

Version:
   2025.8.16 linux-x64 (2025-08-21)

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

ben in sync on  master [+] is 󰏗 v1.0.0 via  v18.20.8 
➜  nix build --no-link --print-out-paths "github:NixOS/nixpkgs/942b0817e898262cc6e3f0a5f706ce09d8f749f1#hello"
/nix/store/nndmy96lswhxc4xp49n950i1905qlfpy-hello-2.10

jcrben avatar Sep 18 '25 01:09 jcrben

I vibe-coded compatibility with nix-portable https://github.com/jbadeau/mise-nix/compare/main...jcrben:mise-nix:main

Understandable if that's not something you want to support. Didn't get 100% of the way there as it requires a wrapper script - think I could get past that tho eventually

jcrben avatar Sep 19 '25 01:09 jcrben

I’ll have a go at it next week. I’m pretty new to nix so need to know what nix portable is doing.

jbadeau avatar Sep 19 '25 06:09 jbadeau