doas: add NixOS binary dirs to safe PATH #89005
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.
I recently tried to give myself passwordless
doas
forvirsh
commands(starting, stopping, and editing VMs), but
doas
was complaining thatit didn't know what
virsh
was.This patch adds
/run/current-system/sw/{s,}bin
and/run/wrappers/bin
to the safe path, allowing system binaries to be discovered and executed
properly.
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)A draft because I'd like to know: should I also add/run/wrappers/bin
to the safe path?EDIT: discussed with @emilazy on IRC, and we determined it should be added (it has things like
ping
!)EDIT2: We also discussed removing the FHS paths, but it doesn't hurt to keep them in... Additionally, somebody might be using
doas
on non-NixOS (for whatever reason) or in abuildFHSEnv
(I don't actually know if that's possible but I don't have the desire to test it).