doas: add NixOS binary dirs to safe PATH

I recently tried to give myself passwordless `doas` for `virsh` commands
(starting, stopping, and editing VMs), but `doas` was complaining that
it 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.
This commit is contained in:
Cole Helbling
2020-05-27 08:11:30 -07:00
parent a1d501b87e
commit 82f897333a
2 changed files with 30 additions and 0 deletions
+6
View File
@@ -26,6 +26,12 @@ stdenv.mkDerivation rec {
"--pamdir=${placeholder "out"}/etc/pam.d"
];
patches = [
# Allow doas to discover binaries in /run/current-system/sw/{s,}bin and
# /run/wrappers/bin
./0001-add-NixOS-specific-dirs-to-safe-PATH.patch
];
postPatch = ''
sed -i '/\(chown\|chmod\)/d' bsd.prog.mk
'';