1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-05 16:27:03 +00:00
nix-darwin/modules
Emily 4bff4bc8ae {activation-scripts,activate-system}: purify environment
This ensures that system activation does not depend on various
details of its process environment, ensuring uniformity across various
invocation contexts and with the `activate-system` daemon. This becomes
more important in a post‐user‐activation world to avoid problematic
dependencies like `$SUDO_USER`, but is a good idea in general.

The `sudoers(5)` defaults on my Sequoia system are:

    Defaults	env_reset
    Defaults	env_keep += "BLOCKSIZE"
    Defaults	env_keep += "COLORFGBG COLORTERM"
    Defaults	env_keep += "__CF_USER_TEXT_ENCODING"
    Defaults	env_keep += "CHARSET LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE"
    Defaults	env_keep += "LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME"
    Defaults	env_keep += "LINES COLUMNS"
    Defaults	env_keep += "LSCOLORS"
    Defaults	env_keep += "SSH_AUTH_SOCK"
    Defaults	env_keep += "TZ"
    Defaults	env_keep += "DISPLAY XAUTHORIZATION XAUTHORITY"
    Defaults	env_keep += "EDITOR VISUAL"
    Defaults	env_keep += "HOME MAIL"

Of these preserved environment variables, the ones that are set in
practice when I run `sudo env` that aren’t set in the activation
script here are:

* `$COLORTERM`
* `$DISPLAY`
* `$EDITOR`
* `$MAIL`
* `$SSH_AUTH_SOCK`
* `$TERM`
* `$__CF_USER_TEXT_ENCODING`

Most of these seem either pointless or actively harmful to set for
the purpose of the system activation script.

This will mean that tools run during activation won’t print output
in the user’s preferred language, but that’s probably the right
trade‐off overall, as that is likely to break activation scripts
that parse command output anyway.
2025-01-27 22:31:15 +00:00
..
documentation Reapply "eval-config: set class" 2024-06-13 14:35:20 +01:00
environment {environment,nix-tools}: correct default $PATH ordering to match macOS 2025-01-15 23:26:14 +00:00
examples {readme,examples/flake}: update for release branches 2025-01-14 01:19:21 +00:00
fonts fonts: remove fonts.fontDir.enable 2024-06-13 11:56:58 +01:00
launchd feat: use wait4path with script launchd option 2024-09-22 15:30:21 +10:00
lib write-text: remove support for copy 2024-06-15 12:15:13 +01:00
misc module: add prometheus-node-exporter service 2024-10-31 02:08:34 +01:00
networking system: tweak ShellCheck settings 2025-01-18 19:34:21 +00:00
nix Merge pull request #1282 from emilazy/push-uqnyoyklywvo 2025-01-26 21:26:41 +00:00
power power: move the check for restartPowerfailure support to checks.nix 2024-12-29 12:13:54 +01:00
programs Merge pull request #1233 from adamcstephens/fish/package 2024-12-29 10:04:09 +11:00
security treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
services {activation-scripts,activate-system}: purify environment 2025-01-27 22:31:15 +00:00
system {activation-scripts,activate-system}: purify environment 2025-01-27 22:31:15 +00:00
time time: shellcheck fix 2024-11-05 11:12:21 +10:00
users system: tweak ShellCheck settings 2025-01-18 19:34:21 +00:00
alias.nix Update def and implementation of nix.package to match NixOS module 2022-08-16 10:41:51 -07:00
homebrew.nix Add --ignore-dependencies option for casks 2025-01-05 10:29:12 -03:00
meta.nix treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
module-list.nix openssh: init module 2025-01-10 10:23:09 +11:00