about summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorFabián Heredia Montiel <fabianhjr@protonmail.com>2023-09-20 15:08:16 -0600
committerFabián Heredia Montiel <fabianhjr@protonmail.com>2023-09-20 15:08:16 -0600
commitb2f85dbf28290f7f11ef31d04019da1df5ebde5d (patch)
treeaed61634f7c1ca38fc7fe42113ac3187faf16508 /nixos/modules/config
parent8d8feb905eb2c52c55e0dda9c1c27e50b2169251 (diff)
parente8dd05c4c439c1ddba7221d9a45245d76ae24372 (diff)
downloadnixlib-b2f85dbf28290f7f11ef31d04019da1df5ebde5d.tar
nixlib-b2f85dbf28290f7f11ef31d04019da1df5ebde5d.tar.gz
nixlib-b2f85dbf28290f7f11ef31d04019da1df5ebde5d.tar.bz2
nixlib-b2f85dbf28290f7f11ef31d04019da1df5ebde5d.tar.lz
nixlib-b2f85dbf28290f7f11ef31d04019da1df5ebde5d.tar.xz
nixlib-b2f85dbf28290f7f11ef31d04019da1df5ebde5d.tar.zst
nixlib-b2f85dbf28290f7f11ef31d04019da1df5ebde5d.zip
Merge remote-tracking branch 'origin/master' into staging-next
Diffstat (limited to 'nixos/modules/config')
-rw-r--r--nixos/modules/config/terminfo.nix28
1 files changed, 21 insertions, 7 deletions
diff --git a/nixos/modules/config/terminfo.nix b/nixos/modules/config/terminfo.nix
index 1ae8e82c471e..d1dbc4e0d059 100644
--- a/nixos/modules/config/terminfo.nix
+++ b/nixos/modules/config/terminfo.nix
@@ -6,12 +6,26 @@ with lib;
 
 {
 
-  options.environment.enableAllTerminfo = with lib; mkOption {
-    default = false;
-    type = types.bool;
-    description = lib.mdDoc ''
-      Whether to install all terminfo outputs
-    '';
+  options = with lib; {
+    environment.enableAllTerminfo = mkOption {
+      default = false;
+      type = types.bool;
+      description = lib.mdDoc ''
+        Whether to install all terminfo outputs
+      '';
+    };
+
+    security.sudo.keepTerminfo = mkOption {
+      default = config.security.sudo.package.pname != "sudo-rs";
+      defaultText = literalMD ''
+        `true` unless using `sudo-rs`
+      '';
+      type = types.bool;
+      description = lib.mdDoc ''
+        Whether to preserve the `TERMINFO` and `TERMINFO_DIRS`
+        environment variables, for `root` and the `wheel` group.
+      '';
+    };
   };
 
   config = {
@@ -54,7 +68,7 @@ with lib;
       export TERM=$TERM
     '';
 
-    security.sudo.extraConfig = ''
+    security.sudo.extraConfig = mkIf config.security.sudo.keepTerminfo ''
 
       # Keep terminfo database for root and %wheel.
       Defaults:root,%wheel env_keep+=TERMINFO_DIRS