dotfiles/nixos/system/doas.nix
Noah Masur d021baa1bb split nixos from darwin
required because they don't share all attributes
2022-12-21 17:07:58 -07:00

36 lines
634 B
Nix

# Replace sudo with doas
{ config, pkgs, lib, ... }: {
config = lib.mkIf pkgs.stdenv.isLinux {
security = {
# Remove sudo
sudo.enable = false;
# Add doas
doas = {
enable = true;
# No password required
wheelNeedsPassword = false;
# Pass environment variables from user to root
# Also requires removing password here
extraRules = [{
groups = [ "wheel" ];
noPass = true;
keepEnv = true;
}];
};
};
home-manager.users.${config.user}.programs.fish.shellAliases = {
sudo = "doas";
};
};
}