mnix: Nix binary-cache client PoC in MoonBit
Store path model + nixbase32, narinfo parser, ed25519 signature verification, NAR reader/writer, closure computation, xz/zstd NAR fetch with hash verification, atomic store unpack, profile management, Hydra-based name resolution, and the mnix CLI. README documents usage, the /nix/store limitation, and what a fuller implementation needs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
82c08d45b1
commit
7ed4bc8e51
9 files changed
+359
-12
No files matched your search
@@ -6,7 +6,7 @@ fn pname_of(name : String) -> String {
|
||||
if chars[i] == '-' && i + 1 < chars.length() {
|
||||
let n = chars[i + 1]
|
||||
if n >= '0' && n <= '9' {
|
||||
return name[0:i].to_string()
|
||||
return name[0:i].to_owned()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ async fn resolve_target(
|
||||
return (sp, pname_of(sp.name))
|
||||
}
|
||||
// "<hash>-<name>" base name given directly?
|
||||
if target.length() > 33 && target[32:33].to_string() == "-" {
|
||||
if target.length() > 33 && target[32:33].to_owned() == "-" {
|
||||
let sp = @store.StorePath::parse_base(target)
|
||||
return (sp, pname_of(sp.name))
|
||||
}
|
||||
@@ -237,6 +237,12 @@ async fn cmd_run(
|
||||
None => ""
|
||||
}
|
||||
let extra : Map[String, String] = { "PATH": "\{cfg.profile.dir}/bin:\{path}" }
|
||||
// The OS spawns argv[0] using *our* PATH, not the child's: resolve
|
||||
// profile commands to their symlink explicitly.
|
||||
let candidate = "\{cfg.profile.dir}/bin/\{argv[0]}"
|
||||
if !argv[0].contains("/") && @installer.lexists(candidate) {
|
||||
argv[0] = candidate
|
||||
}
|
||||
try {
|
||||
if cfg.store_dir == @store.default_store_dir {
|
||||
@process.run(argv[0], argv[1:], extra_env=extra)
|
||||
|
||||
Reference in new issue
Block a user