Skip to content

Commit

Permalink
feat: nh doas wrapper only runs under root for commands that need root
Browse files Browse the repository at this point in the history
  • Loading branch information
youwen5 committed Dec 30, 2024
1 parent f3bc3dc commit 71829db
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions hm/modules/linux/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
# wrapper for nh as it doesn't work with `doas`
body = ''
if count $argv > /dev/null
if contains -- os $argv or contains -- clean $argv
doas ${pkgs.nh}/bin/nh $argv -R
else
${pkgs.nh}/bin/nh $argv
end
set subcommand (string join " " $argv)
if contains -- $subcommand "os switch" "os test" "os boot" "clean all"
doas ${pkgs.nh}/bin/nh $argv -R
else
${pkgs.nh}/bin/nh $argv
end
else
${pkgs.nh}/bin/nh
end
Expand Down

0 comments on commit 71829db

Please sign in to comment.