b2791022ccb1
fix run double-prefix (pass flake refs as-is) and develop --command (sh -c); add G-08/G-10 test; v3.0.8
- time
- 2026-05-30 02:44 UTC · 4 months ago
- machine
- koh2
- parent
- bed6a267e635
↓ nina-b2791022.tar.gzatlas at this save
files changed3 files
build.zig.zon+1 −1src/exec.zig+6 −1test/vm/tests/flakeupdate.sh+39 −0build.zig.zon+1 −1
@@ -9,7 +9,7 @@99 .name = .nina,1010 // This is a [Semantic Version](https://semver.org/).1111 // In a future version of Zig it will be used for package deduplication.12- .version = "3.0.7",12+ .version = "3.0.8",1313 // Together with name, this represents a globally unique package1414 // identifier. This field is generated by the Zig toolchain when the1515 // package is first created, and then *never changes*. This allowssrc/exec.zig+6 −1
@@ -431,6 +431,10 @@431431 if (is_url) {432432 return stream(io, machine, gpa, &.{ "nix", "run", pkg, "--no-write-lock-file" });433433 }434+ // Already a flake ref (contains '#') → use as-is; bare name → default to nixpkgs#.435+ if (std.mem.indexOfScalar(u8, pkg, '#') != null) {436+ return stream(io, machine, gpa, &.{ "nix", "run", pkg });437+ }434438 const ref = try std.fmt.allocPrint(gpa, "nixpkgs#{s}", .{pkg});435439 defer gpa.free(ref);436440 return stream(io, machine, gpa, &.{ "nix", "run", ref });@@ -444,7 +448,8 @@444448 445449 pub fn nixDevelop(io: std.Io, machine: *const types.Machine, gpa: std.mem.Allocator, run_cmd: ?[]const u8) !u8 {446450 if (run_cmd) |cmd| {447- return stream(io, machine, gpa, &.{ "nix", "develop", "--command", cmd });451+ // sh -c so a multi-word command isn't treated as a single executable name.452+ return stream(io, machine, gpa, &.{ "nix", "develop", "--command", "sh", "-c", cmd });448453 }449454 return stream(io, machine, gpa, &.{ "nix", "develop" });450455 }test/vm/tests/flakeupdate.sh+39 −0
@@ -0,0 +1,39 @@1+#!/usr/bin/env sh2+# G-08 update + G-10 flakes/build/run/repl/develop. Flake ops run in a fresh3+# flake dir. repl/develop are interactive (nix repl / nix shell) — `</dev/null`4+# feeds EOF so they exit. develop uses a `run` subcommand (nina develop run CMD),5+# not --run.6+set -u7+N=/root/nina8+9+echo "KILN_FLAKE_BEGIN"10+11+echo "### G-08 T-100 nina update (nix-channel --update; network)"12+$N update </dev/null; echo "UPDATE_RC=$?"13+14+mkdir -p /root/tf && cd /root/tf || exit 915+echo "### G-10 T-120 nina flake init (expect flake.nix)"16+$N flake init </dev/null; echo "FLAKEINIT_RC=$?"; echo "flake.nix: $(ls flake.nix 2>/dev/null || echo MISSING)"17+18+echo "### G-10 T-123 nina flake show"19+$N flake show </dev/null; echo "FLAKESHOW_RC=$?"20+21+echo "### G-10 T-122 nina flake check"22+$N flake check </dev/null; echo "FLAKECHECK_RC=$?"23+24+echo "### G-10 T-121 nina flake update (expect flake.lock)"25+$N flake update </dev/null; echo "FLAKEUPD_RC=$?"; echo "flake.lock: $(ls flake.lock 2>/dev/null || echo MISSING)"26+27+echo "### G-10 T-125 nina build (expect result symlink)"28+$N build </dev/null; echo "BUILD_RC=$?"; echo "result: $(ls -l result 2>/dev/null | awk '{print $NF}' || echo MISSING)"29+30+echo "### G-10 T-126 nina run nixpkgs#hello (expect Hello, world!)"31+$N run nixpkgs#hello </dev/null; echo "RUN_RC=$?"32+33+echo "### G-10 T-128 nina repl (EOF exits)"34+$N repl </dev/null; echo "REPL_RC=$?"35+36+echo "### G-10 T-130 nina develop run 'echo devshell-ok'"37+$N develop run 'echo devshell-ok' </dev/null; echo "DEVRUN_RC=$?"38+39+echo "KILN_FLAKE_END"