cc6de0e806d9
fix remaining open code-review items, bump v3.1.3 — (LOW) home-manager build no longer litters ./result in the cwd: homeManagerBuild now runs 'sh -c d=$(mktemp -d) && cd "$d" && home-manager build' (affects home check + home apply --dry). (LOW) useFlakeFlag trims trailing slashes before the /etc/nixos comparison so '/etc/nixos/' is still treated as the default (no spurious --flake). Golden fixture: home.nix sets home.enableNixpkgsReleaseCheck=false (master tracks unstable; the 26.05-vs-26.11 mismatch warning is spurious) — applies on next rebake. Verified on the golden: no ./result after check/apply--dry, module-mode dispatch redirects to 'nina apply' (closes the last verification gap), normal home apply + check still work. Confirmed-correct non-defects left as-is (seen.put dedup, parseHomeGenerations empty-path guarded at call sites). VERSION/zon -> 3.1.3, build+tests green
- time
- 2026-06-10 12:59 UTC · 4 months ago
- machine
- koh2
- agent
- claude-opus-4-8
- session
- flake + home manager support
- parent
- 60b58bedad52
↓ nina-cc6de0e8.tar.gzatlas at this save
files changed3 files
VERSION+1 −1build.zig.zon+1 −1src/exec.zig+10 −4build.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.1.2",12+ .version = "3.1.3",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+10 −4
@@ -189,9 +189,13 @@189189 190190 // nixos-rebuild auto-detects /etc/nixos/flake.nix, so the --flake flag is only191191 // needed when the flake lives elsewhere. A flake at a non-default path must be192-// passed explicitly or nixos-rebuild falls back to channels.192+// passed explicitly or nixos-rebuild falls back to channels. Compare with193+// trailing slashes trimmed so "/etc/nixos/" is still treated as the default.193194 fn useFlakeFlag(gpa: std.mem.Allocator, io: std.Io, machine: *const types.Machine) bool {194- return configHasFlake(gpa, io, machine) and !std.mem.eql(u8, machine.config_path, "/etc/nixos");195+ if (!configHasFlake(gpa, io, machine)) return false;196+ var path = machine.config_path;197+ while (path.len > 1 and path[path.len - 1] == '/') path = path[0 .. path.len - 1];198+ return !std.mem.eql(u8, path, "/etc/nixos");195199 }196200 197201 fn nixosRebuildRun(io: std.Io, machine: *const types.Machine, gpa: std.mem.Allocator, verb: []const u8, flake: bool) !u8 {@@ -1148,9 +1152,11 @@11481152 }11491153 11501154 // Build (and validate) the home config without activating it — used by `home1151-// check` and `home apply --dry`.1155+// check` and `home apply --dry`. `home-manager build` drops a ./result symlink1156+// in the cwd, so run it in a throwaway temp dir to avoid littering the directory1157+// nina was invoked from.11521158 pub fn homeManagerBuild(io: std.Io, machine: *const types.Machine, gpa: std.mem.Allocator) !u8 {1153- return stream(io, machine, gpa, &.{ "home-manager", "build" });1159+ return stream(io, machine, gpa, &.{ "sh", "-c", "d=$(mktemp -d) && cd \"$d\" && home-manager build" });11541160 }11551161 11561162 pub fn homeGenerations(gpa: std.mem.Allocator, io: std.Io, machine: *const types.Machine) ![]u8 {