Skip to content

feat: nix hackery#13267

Open
frezbo wants to merge 1 commit into
siderolabs:mainfrom
frezbo:feat/nix-hackery
Open

feat: nix hackery#13267
frezbo wants to merge 1 commit into
siderolabs:mainfrom
frezbo:feat/nix-hackery

Conversation

@frezbo

@frezbo frezbo commented May 1, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 1, 2026 17:45
@github-project-automation github-project-automation Bot moved this to To Do in Planning May 1, 2026
@talos-bot talos-bot moved this from To Do to In Review in Planning May 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new debug “host mount namespace” mode that overlays Nix tooling at /nix while running directly against the host rootfs (no nsenter), exposed via a new API profile and a talosctl debug --host-ns flag.

Changes:

  • Introduces PROFILE_HOST_NS in the debug API (proto + generated Go bindings).
  • Implements host-namespace debug execution using a forked mount namespace + overlayfs + bind-mounting image /nix.
  • Updates talosctl debug to support --host-ns and to default the image when host-ns is used.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
pkg/machinery/constants/constants.go Adds a default image reference for host-ns debug sessions.
api/machine/debug.proto Adds PROFILE_HOST_NS to the DebugContainerRunRequestSpec.Profile enum.
pkg/machinery/api/machine/debug.pb.go Regenerates Go bindings to include the new profile enum value.
internal/app/debug/hostns.go New host-namespace debug runner (mount namespace fork, overlay rootfs, bind /nix, chroot, exec).
internal/app/debug/debug.go Routes debug sessions to host-ns runner when the new profile is selected.
internal/app/debug/container_streams.go Adds host-ns streaming coordinator and recv loop variant.
cmd/talosctl/cmd/talos/debug.go Adds --host-ns, makes image arg optional in host-ns mode, passes profile through to server.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/app/debug/debug.go
Comment thread pkg/machinery/constants/constants.go
Comment thread cmd/talosctl/cmd/talos/debug.go
Comment thread internal/app/debug/container_streams.go
Comment thread internal/app/debug/container_streams.go Outdated
Comment thread internal/app/debug/hostns.go Outdated
Comment thread internal/app/debug/hostns.go Outdated
Comment thread internal/app/debug/hostns.go Outdated
Signed-off-by: Noel Georgi <git@frezbo.dev>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +241 to +245
for _, dir := range []string{"dev", "proc", "sys"} {
src := "/" + dir
dst := filepath.Join(merged, dir)

if mkErr := os.MkdirAll(dst, 0o755); mkErr != nil {
Comment on lines +279 to +283
case <-ctx.Done():
g.stdoutW.Close() //nolint:errcheck
g.stdinW.Close() //nolint:errcheck

if recvLoopCh != nil {
cgroupFd.Close() //nolint:errcheck

if launchErr != nil {
log.Printf("host-ns: launch error: %v", launchErr)
Comment on lines +288 to +292
// chroot into the overlay.
// After this point all absolute paths resolve from the merged root:
// /usr/local/sbin/zpool → host binary ✓
// /nix/store/<h>/bin/jq → image tool ✓
if err = unix.Chroot(merged); err != nil {

@smira smira left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is crazy amount of code, should we put it under debug build tag?

I wonder if we should hide the flag, and hide the server implementation under a build tag, so it's not available in general? this is powerful, but imho too much crazy to understand all consequences for a production run

@frezbo

frezbo commented May 5, 2026

Copy link
Copy Markdown
Member Author

this is crazy amount of code, should we put it under debug build tag?

I wonder if we should hide the flag, and hide the server implementation under a build tag, so it's not available in general? this is powerful, but imho too much crazy to understand all consequences for a production run

After discussion, let's put this under a debug flag and only enable for CI tests or along similar lines

@smira smira moved this from In Review to On Hold in Planning May 11, 2026
@frezbo frezbo closed this Jun 5, 2026
@frezbo frezbo deleted the feat/nix-hackery branch June 5, 2026 13:03
@github-project-automation github-project-automation Bot moved this from On Hold to Done in Planning Jun 5, 2026
@frezbo frezbo restored the feat/nix-hackery branch June 5, 2026 13:05
@frezbo frezbo reopened this Jun 5, 2026
@github-project-automation github-project-automation Bot moved this from Done to In Progress in Planning Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

4 participants