refactor: replace nix crate with rustix + users #280
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR replaces the
nixcrate withrustixanduserscrates for user lookups and file ownership operations. This change improves long-term maintainability by moving to more focused, stable dependencies.Motivation
The current
nixdependency is used in a very limited way (user lookups and chown), but introduces several long‑term risks:The replacement crates offer better stability.
Changes
Code Updates
Ssh User
The
nix::unistd::Usertype exposes mutable public fields, which allowed tests to override values such as the home directory. Theusers::User typeis immutable and getter-only.To preserve testability without relying on mutable system structs, this PR introduces a small
SshUserdata holder that can be:users::Userin productionAdvantages:
Disadvantages: