Skip to content

fix(system): use wrapper for local env when necessary#182

Merged
water-sucks merged 3 commits intonix-community:mainfrom
water-sucks:use-wrapper-for-local-env
Feb 19, 2026
Merged

fix(system): use wrapper for local env when necessary#182
water-sucks merged 3 commits intonix-community:mainfrom
water-sucks:use-wrapper-for-local-env

Conversation

@water-sucks
Copy link
Copy Markdown
Collaborator

The current wrapper for setting variables through SSH env var sanitation barriers works pretty well in that instance, but needed to be expanded to work with local systems so that it can pass through sudo/other root escalation barriers as well, since those tend to sanitize the environment variables for the subprocess they run.

As such, this PR adds tests for the now-exported shell wrapper builder, and makes all systems use it when environment variables need to be passed through these barriers. I added an extra method to inherit environment variables explicitly when necessary as well, although this does need to be done on a per-process and opt-in basis, since I do not want to risk breaking subcommand invariants when they are invoked through sudo (i.e. sudo rewrites the HOME of the process to be /root, so we shouldn't preserve that; things like that that are more of a hassle to maintain than just opting-in to env var preservation).

Closes #180, for real this time hopefully.

@water-sucks
Copy link
Copy Markdown
Collaborator Author

@Sporif I would really appreciate your input on this change, since you reported the issue as well.

@water-sucks water-sucks force-pushed the use-wrapper-for-local-env branch from cf0f5c1 to 67eb3af Compare February 18, 2026 23:48
@Sporif
Copy link
Copy Markdown
Collaborator

Sporif commented Feb 19, 2026

It now works perfectly for local and remote activation, thanks! I just had two small nits, feel free to ignore them.

@water-sucks
Copy link
Copy Markdown
Collaborator Author

I just had two small nits, feel free to ignore them.

I think they might have disappeared or something? Don't see them at all. I'll just request you for review and you can post them as an actual review requesting changes :}

@water-sucks water-sucks requested a review from Sporif February 19, 2026 07:41
@Sporif
Copy link
Copy Markdown
Collaborator

Sporif commented Feb 19, 2026

I just had two small nits, feel free to ignore them.

I think they might have disappeared or something? Don't see them at all. I'll just request you for review and you can post them as an actual review requesting changes :}

Sorry, I forgot to press submit review 😅.

@water-sucks water-sucks force-pushed the use-wrapper-for-local-env branch from 67eb3af to d787539 Compare February 19, 2026 07:49
@water-sucks water-sucks force-pushed the use-wrapper-for-local-env branch from d787539 to bd31c7f Compare February 19, 2026 07:50
@water-sucks
Copy link
Copy Markdown
Collaborator Author

Sorry, I forgot to press submit review 😅.

All good! I'm gonna merge this since you have tested it a bit; I've also done some testing on my own end and everything seems to check out.

@water-sucks water-sucks merged commit a1d2b76 into nix-community:main Feb 19, 2026
2 checks passed
@water-sucks water-sucks deleted the use-wrapper-for-local-env branch February 19, 2026 07:53
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.

apply: necessary environment variables are not passed to switch-to-configuration with --local-root or --remote-root

2 participants