nixos/terminfo: inherit TERMINFO* env vars also for doas

This should mirror the behavior we implement for sudo: The TERMINFO and
TERMINFO_DIRS variables are inherited from the normal user's
environment, so terminfo files installed in the user's profile can be
found by ncurses applications running as root.

authored by

sternenseemann and committed by helbling.dev d14ae626 0f410940

+9 -1
+1 -1
nixos/modules/security/doas.nix
··· 15 (optionalString rule.noLog "nolog") 16 (optionalString rule.persist "persist") 17 (optionalString rule.keepEnv "keepenv") 18 - "setenv { SSH_AUTH_SOCK ${concatStringsSep " " rule.setEnv} }" 19 ]; 20 21 mkArgs = rule:
··· 15 (optionalString rule.noLog "nolog") 16 (optionalString rule.persist "persist") 17 (optionalString rule.keepEnv "keepenv") 18 + "setenv { SSH_AUTH_SOCK TERMINFO TERMINFO_DIRS ${concatStringsSep " " rule.setEnv} }" 19 ]; 20 21 mkArgs = rule:
+8
nixos/tests/doas.nix
··· 85 # ../../pkgs/tools/security/doas/0001-add-NixOS-specific-dirs-to-safe-PATH.patch 86 with subtest("recursive calls to doas from subprocesses should succeed"): 87 machine.succeed('doas -u test0 sh -c "doas -u test0 true"') 88 ''; 89 } 90 )
··· 85 # ../../pkgs/tools/security/doas/0001-add-NixOS-specific-dirs-to-safe-PATH.patch 86 with subtest("recursive calls to doas from subprocesses should succeed"): 87 machine.succeed('doas -u test0 sh -c "doas -u test0 true"') 88 + 89 + with subtest("test0 should inherit TERMINFO_DIRS from the user environment"): 90 + dirs = machine.succeed( 91 + "su - test0 -c 'doas -u root $SHELL -c \"echo \$TERMINFO_DIRS\"'" 92 + ) 93 + 94 + if not "test0" in dirs: 95 + raise Exception(f"user profile TERMINFO_DIRS is not preserved: {dirs}") 96 ''; 97 } 98 )