1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-09 10:17:02 +00:00
Commit graph

52 commits

Author SHA1 Message Date
Emily
cc9c8408bb Revert "{activation-scripts,activate-system}: purify environment"
This shouldn’t actually be split out from the Plan because of the
current use of `$HOME` in the defaults for channel‐based setups.

This reverts commit 4bff4bc8ae.
2025-01-28 02:31:59 +00:00
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
Emily
ff80eacd0f activation-scripts: remove _status
I believe this has been obsolete since `set -e` was added in
8708ebb796.
2025-01-27 22:31:15 +00:00
Michael Hoang
55be3e1a5f users: move checks to system.checks 2024-10-27 21:52:41 +11:00
Philip Børgesen
f737259769 power,sleep: Add options to control restart and sleep behavior 2024-10-24 06:13:11 +02:00
Michael Hoang
a6903cf7e3 activation-scripts: add extra comment 2024-07-27 10:39:57 +10:00
Weijia Wang
def1e23be8 treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
Sam
0363c18c37
system.nvram: init (internal) 2024-02-29 22:20:04 -08:00
Emily
4eb1c549a9 etc: check for existing files during checks stage
This ensures that activation fails early if there are any `/etc` files
with unexpected state, rather than leaving the system half-activated.
2023-07-16 12:15:07 +01:00
Michael Hoang
5288a72354 Allow flaky installation with darwin-rebuild 2023-07-11 18:59:05 +10:00
Emily
e65131e69c treewide: convert all option docs to Markdown
This process was automated by [my fork of `nix-doc-munge`]; thanks
to @pennae for writing this tool! It automatically checks that the
resulting documentation doesn't change, although my fork loosens
this a little to ignore some irrelevant whitespace and typographical
differences.

As of this commit there is no DocBook remaining in the options
documentation.

You can play along at home if you want to reproduce this commit:

    $ NIX_PATH=nixpkgs=flake:nixpkgs/c1bca7fe84c646cfd4ebf3482c0e6317a0b13f22 \
      nix shell nixpkgs#coreutils \
      -c find . -name '*.nix' \
      -exec nix run github:emilazy/nix-doc-munge/0a7190f600027bf7baf6cb7139e4d69ac2f51062 \
      {} +

[my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge
2023-06-24 10:48:55 +01:00
Malo Bourgon
ca57e8bcdb Change option name and switch to using activation script 2022-06-30 13:32:46 -07:00
Malo Bourgon
e1425db70d Move programs.brew-bundle to homebrew 2020-12-17 13:03:57 -08:00
Malo Bourgon
31b0d5cb59 Move brew-bundle activation to user 2020-12-08 10:33:46 -08:00
Malo Bourgon
c3bddd3e91 Add Homebrew Bundle module 2020-12-08 09:47:52 -08:00
Daiderd Jordan
74eb216078
remove nix 1.x config compatibility 2020-10-25 15:56:29 +01:00
Daiderd Jordan
77121650d4
system: add patches module 2020-05-29 21:29:20 +02:00
Daiderd Jordan
d56312be06
activation-scripts: create /run
In case this was removed or not bootstrapped by the installer.
2019-06-05 23:10:07 +02:00
Piotr Limanowski
7a7cbdc165 initialise fonts module 2018-09-30 13:22:24 +02:00
Daiderd Jordan
a893723b95
activation: fix missing /sbin entries in PATH 2018-08-01 21:08:13 +02:00
Kirill Elagin
26bab2fd32 installer and activation: Sanitise PATH
This makes sure that the installation and activation processes are “pure”,
i.e. they use only binaries from nixpkgs or ones that come with macOS.

Closes #86.
2018-06-29 18:51:41 +03:00
Daiderd Jordan
e3281c90cf
defaults: move com.apple.smb.server to /activate
Currently fails with permission errors.
2018-01-17 23:10:57 +01:00
Daiderd Jordan
29f9fb52b3
activation-scripts: include system in PATH
This makes rollback more reliable by using the same version of tools
that where used previously. For example nix is used during the
activation checks.
2018-01-14 22:02:27 +01:00
Daiderd Jordan
174a36a296
activation: rename pre/post hooks
Renamed extraPostActivation and extraUserPostActivation.
2018-01-13 17:12:02 +01:00
Daiderd Jordan
b8713d540c
users: add options for user creation 2018-01-13 13:42:49 +01:00
Daiderd Jordan
b593f31822
users: add options to create user groups 2018-01-13 02:01:15 +01:00
Daiderd Jordan
edc3be51ce
keyboard: add options for keyboard mappings
Fixes #55
2018-01-08 22:01:44 +01:00
Daiderd Jordan
f63f4fe3fb
nix: reload daemon when nix.conf changes 2018-01-03 20:10:24 +01:00
John Wiegley
e8a0378790 Allow for postActivation scripts, that happen last 2018-01-02 12:36:34 -08:00
Daiderd Jordan
c4e213745a
security-accessibility: remove options
The accessibility database has been protected with SIP since macOS
10.12 and there doesn't seem to be another way to configure this
programmatically.
2017-11-29 00:14:31 +01:00
Daiderd Jordan
8016f1e2fd
add activation-checks 2017-07-23 16:05:46 +02:00
Piotr Limanowski
8fe2cff0cc
Adds an idea for networking module
The idea is to follow: https://nixos.org/nixos/options.html#networking so we can
share even more configuration ideas from NixOS.
2017-07-05 22:17:58 +02:00
Daiderd Jordan
290b1d8aad
system-packages: link applications to ~/Applications 2017-05-20 14:23:05 +02:00
Daiderd Jordan
cf3c3cb082
security: add option to configure accessibilityPrograms 2017-05-16 00:10:21 +02:00
Daiderd Jordan
1b6f56f5b8
environment: include /usr/sbin and /sbin in systemPath
Don't extend initial PATH adding extra entries should be done through
appending environment.systemPath or manually extending it with
environment.extraInit or similar options.
2017-05-15 19:46:34 +02:00
Daiderd Jordan
e9cf765076
activation-scripts: run custom activation scripts first 2017-05-13 23:32:02 +02:00
Daiderd Jordan
2e93c9ca29
activation-scripts: don't link current system before all activationScripts finish 2017-03-04 19:41:13 +01:00
Daiderd Jordan
74c27037e6
nix-daemon: check for nixbld group before activation
Fixes #9
2017-02-19 13:30:26 +01:00
Daiderd Jordan
0cbdc2f8f9
launchd: add user agents 2017-01-25 22:35:06 +01:00
Daiderd Jordan
5a5ec9ac42
nix.distributedBuilds: create directory for current load 2017-01-09 22:30:15 +01:00
Daiderd Jordan
6305c0675f
move write-text submodule 2017-01-02 08:21:54 +01:00
Daiderd Jordan
807872e8f3
add extra activation scripts 2016-12-19 20:31:59 +01:00
Daiderd Jordan
345941b4d8
add time.timeZone option 2016-12-16 12:20:28 +01:00
Daiderd Jordan
6af52615ed
add activate-user script 2016-12-14 12:32:20 +01:00
Daiderd Jordan
8708ebb796
move nix-tools out of nix expression 2016-12-12 17:34:43 +01:00
Daiderd Jordan
033499c0ed
only activate system profile with sudo 2016-12-07 23:06:18 +01:00
Daiderd Jordan
7b3ace08c5
add service module for system activation 2016-12-04 10:38:21 +01:00
Daiderd Jordan
9a5af2ee4a
fix system activation service 2016-12-03 22:44:36 +01:00
Daiderd Jordan
61a91d3c99
improve system activation 2016-12-02 23:54:46 +01:00
Daiderd Jordan
d82c472ab0
add initial support for system defaults 2016-12-01 21:34:37 +01:00