1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-06 00:37:00 +00:00
nix-darwin/modules/services
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
..
activate-system {activation-scripts,activate-system}: purify environment 2025-01-27 22:31:15 +00:00
aerospace aerospace: add workspace-to-monitor-force-assignment option and fix on-window-detected type #1208 2024-12-29 16:57:26 +05:30
github-runner github-runner: add instructions for triggering a runner registration 2024-12-07 13:08:55 +11:00
hercules-ci-agent hercules-ci-agent: fix crash calling security 2024-05-21 23:16:46 +10:00
jankyborders Update modules/services/jankyborders/default.nix 2024-10-02 10:38:08 -06:00
karabiner-elements karabiner-elements: allow use of custom package 2024-10-31 16:51:05 +01:00
khd treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
kwm treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
mail treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
monitoring prometheus-node-exporter: fix log permissions 2024-11-05 03:00:55 +00:00
nextdns nextdns: fix argument handling 2024-07-08 16:36:31 -03:00
nix-gc fix(launchd): improve StartCalendarInterval 2024-06-09 11:20:15 -07:00
nix-optimise feat: use wait4path with script launchd option 2024-09-22 15:30:21 +10:00
ofborg ofborg: automatically add ofborg to known{Users,Groups} 2024-11-07 11:41:51 +11:00
postgresql Merge pull request #794 from fesplugas/patch-1 2024-10-13 08:39:35 +11:00
privoxy treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
redis treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
sketchybar chore: remove mkpackageoptionmd deprecation 2024-07-01 16:24:41 +02:00
skhd skhd: add skhd to PATH 2024-10-14 17:18:08 +11:00
spacebar treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
synergy treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
yabai treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
autossh.nix treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
buildkite-agents.nix buildkit-agents: don't use mkdir -p -m 2024-11-07 17:31:22 +11:00
cachix-agent.nix cachix-agent: fix crash calling security 2024-05-16 18:04:33 +04:00
chunkwm.nix treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
dnsmasq.nix treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
emacs.nix Add keepalive flag for emacs service 2024-10-26 13:05:25 -04:00
eternal-terminal.nix treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
gitlab-runner.nix treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
ipfs.nix treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
lorri.nix treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
mopidy.nix treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
netbird.nix treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
nix-daemon.nix nix-daemon: enable by default 2024-11-16 23:19:11 +11:00
openssh.nix openssh: init module 2025-01-10 10:23:09 +11:00
spotifyd.nix treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
synapse-bt.nix treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
tailscale.nix feat: use wait4path with script launchd option 2024-09-22 15:30:21 +10:00
trezord.nix treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
wg-quick.nix treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00