mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2025-01-02 17:09:09 +03:00
nixos/sudo: Refactor checks for Todd C. Miller's implemetation
This commit is contained in:
parent
f5aadb56be
commit
8b9e867ac8
@ -4,13 +4,15 @@ with lib;
|
|||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
inherit (pkgs) sudo;
|
||||||
|
|
||||||
cfg = config.security.sudo;
|
cfg = config.security.sudo;
|
||||||
|
|
||||||
enableSSHAgentAuth =
|
enableSSHAgentAuth =
|
||||||
with config.security;
|
with config.security;
|
||||||
pam.enableSSHAgentAuth && pam.sudo.sshAgentAuth;
|
pam.enableSSHAgentAuth && pam.sudo.sshAgentAuth;
|
||||||
|
|
||||||
inherit (pkgs) sudo;
|
usingMillersSudo = cfg.package.pname == sudo.pname;
|
||||||
|
|
||||||
toUserString = user: if (isInt user) then "#${toString user}" else "${user}";
|
toUserString = user: if (isInt user) then "#${toString user}" else "${user}";
|
||||||
toGroupString = group: if (isInt group) then "%#${toString group}" else "%${group}";
|
toGroupString = group: if (isInt group) then "%#${toString group}" else "%${group}";
|
||||||
@ -197,8 +199,8 @@ in
|
|||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
{ assertion = cfg.package.pname != "sudo-rs";
|
{ assertion = usingMillersSudo;
|
||||||
message = "The NixOS `sudo` module does not work with `sudo-rs` yet."; }
|
message = "The NixOS `sudo` module does not yet work with other implementations."; }
|
||||||
];
|
];
|
||||||
|
|
||||||
# We `mkOrder 600` so that the default rule shows up first, but there is
|
# We `mkOrder 600` so that the default rule shows up first, but there is
|
||||||
|
Loading…
Reference in New Issue
Block a user