From 454151375d626a148fdb4423d577994319d6bd97 Mon Sep 17 00:00:00 2001 From: nicoo Date: Mon, 4 Sep 2023 21:01:09 +0000 Subject: [PATCH] nixos/sudo: Don't include empty sections This makes the generated sudoers a touch easier to read. --- nixos/modules/security/sudo.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nixos/modules/security/sudo.nix b/nixos/modules/security/sudo.nix index adf83c7a045a..ad7d43d2682b 100644 --- a/nixos/modules/security/sudo.nix +++ b/nixos/modules/security/sudo.nix @@ -205,7 +205,7 @@ in } ]; - security.sudo.configFile = concatStringsSep "\n" [ + security.sudo.configFile = concatStringsSep "\n" (filter (s: s != "") [ '' # Don't edit this file. Set the NixOS options ‘security.sudo.configFile’ # or ‘security.sudo.extraRules’ instead. @@ -218,7 +218,7 @@ in # "root" is allowed to do anything. root ALL=(ALL:ALL) SETENV: ALL '' - '' + (optionalString (cfg.extraRules != []) '' # extraRules ${concatStringsSep "\n" ( lists.flatten ( @@ -230,12 +230,12 @@ in ) cfg.extraRules ) )} - '' - '' + '') + (optionalString (cfg.extraConfig != "") '' # extraConfig ${cfg.extraConfig} - '' - ]; + '') + ]); security.wrappers = let owner = "root";