Skip to content

fix: detect host platform in init and clarify remote SSH probe failures#470

Open
RobertDeRose wants to merge 2 commits intonumtide:mainfrom
RobertDeRose:fix/init-host-platform
Open

fix: detect host platform in init and clarify remote SSH probe failures#470
RobertDeRose wants to merge 2 commits intonumtide:mainfrom
RobertDeRose:fix/init-host-platform

Conversation

@RobertDeRose
Copy link
Copy Markdown

Summary

  • detect the current host platform when system-manager init generates system.nix
  • avoid hardcoding x86_64-linux in scaffolds created on non-x86_64-linux hosts
  • clarify remote deploy errors so SSH user/auth/connect problems do not look like nix-store PATH failures

Testing

  • nix develop --accept-flake-config --command cargo test -p system-manager
  • confirmed on an aarch64-linux Lima VM that upstream main generates nixpkgs.hostPlatform = "x86_64-linux";

fixes #469

Copy link
Copy Markdown
Member

@eureka-cpu eureka-cpu left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution and clean individual commits @RobertDeRose 🙂

@eureka-cpu
Copy link
Copy Markdown
Member

eureka-cpu commented Apr 26, 2026

The debian container is failing a bit ambiguously, maybe just needs to be retried. All other checks passed.

@RobertDeRose
Copy link
Copy Markdown
Author

@eureka-cpu No problem. I'll see if I can figure out what about this change fails on Debian

@eureka-cpu
Copy link
Copy Markdown
Member

@eureka-cpu No problem. I'll see if I can figure out what about this change fails on Debian

I just re-ran it and it passes, must've been a network error: https://buildbot.numtide.com/#/builders/3075/builds/8

Comment thread crates/system-manager/src/main.rs Outdated
Comment thread crates/system-manager/src/main.rs Outdated
Comment thread crates/system-manager/src/main.rs
Comment thread crates/system-manager/src/main.rs Outdated
Comment thread crates/system-manager/src/main.rs Outdated
- render the generated system.nix template with the current host architecture instead of always emitting x86_64-linux
- distinguish SSH connection/authentication problems from a successful remote login where nix-store is actually missing
- point users at the equivalent ssh command to verify their target host and options first
@RobertDeRose RobertDeRose force-pushed the fix/init-host-platform branch from 1a84a08 to 75c7096 Compare April 28, 2026 02:20
@RobertDeRose
Copy link
Copy Markdown
Author

@jfroche I believe I have addressed all your feedback

Copy link
Copy Markdown
Member

@picnoir picnoir left a comment

Choose a reason for hiding this comment

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

Overall, I think this feature makes sense. But I don't think this is the right approach, it is a bit brittle. Instead of search-replacing x86_64-linux, we should use a generic placeholder and override it to inject the arch-os duo.

That being said, chris approved this, let's not drive you mad with a gazillion back and forth. Let's merge that and I'll fix this in a subsequent commit.

Let's remove the useless tests and merge this.

Also, if this is LLM generated, please review the output before submitting it in the future.

Comment thread crates/system-manager/src/main.rs
Comment thread crates/system-manager/src/main.rs
Comment thread crates/system-manager/src/main.rs
@eureka-cpu
Copy link
Copy Markdown
Member

@picnoir i hadn't reviewed the latest commit, I think originally it looked okay and I agree it is a bit brittle but then we also have to consider that the template must also work for nix flake init --template


let system_config_filepath = path.join("system.nix");
init_config_file(&system_config_filepath, SYSTEM_MODULE_TEMPLATE)?;
let host_platform = std::env::consts::ARCH.to_owned() + "-linux";
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.

I missed this. Please keep in mind that not every ARCH is a system supported by the flake, and the system namespace may be different between rust and nix, so you may want to have an explicit mapping and error for those cases.

https://doc.rust-lang.org/std/env/consts/constant.ARCH.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

system-manager init hardcodes x86_64-linux in generated system.nix

4 participants