1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-06 16:57:08 +00:00
Commit graph

384 commits

Author SHA1 Message Date
Emily
03877755e9 checks: add check for Determinate
This provides a more useful error message than the `/etc/nix/nix.conf`
hash mismatch error that would otherwise occur.
2025-02-07 20:08:26 +00:00
Emily
fb2bc03f92 activation-scripts: add unmanaged system Nix to activation path
Currently, the `bin` directory of the configured system
is embedded in the `$PATH` of activation scripts, but not
other elements of the default `environment.systemPath` like
`/nix/var/nix/profiles/default/bin` or `/usr/local/bin`. This
means that when nix-darwin is not managing the Nix installation,
activation scripts like Home Manager’s that want to look up the
system‐managed Nix can’t find it. Search for it on the entire
`environment.systemPath` and add the appropriate directory if found.

We leave the launchd `activate-system` daemon alone, because it has
erroneously referred to `@out@/sw/bin` forever and therefore never got
a Nix on the path to begin with. That’s a problem for another time.

(The more ideal solution is probably for Home Manager activation to
be driven by launchd or something, but that’s a longer‐term goal.)
2025-02-07 20:08:26 +00:00
Emily
adc989f7ec nix: remove nix.configureBuildUsers
We now manage the build users unconditionally when we manage the
Nix installation.
2025-02-07 19:44:59 +00:00
Emily
c796587d2e nix: remove nix.useDaemon
We now assume the daemon is used unconditionally when we manage the
Nix installation.

The `nix.gc` and `nix.optimise` services lose their `$NIX_REMOTE`
setting rather than making it unconditional, as the NixOS `nix.gc`
module does not set it. Possibly it should, but I think uniformity
between the two systems is better than diverging, even though I kind
of hate that the non‐daemon method of access is even a thing.
2025-02-07 19:44:59 +00:00
Emily
e182d8dff6 nix: add nix.enable option to disable Nix management
This is an equivalent of the `nix.enable` option from NixOS
and Home Manager. On NixOS, it mostly serves to allow building
fixed‐configuration systems without any Nix installation at
all. It should work for that purpose with nix-darwin too, and the
implementation is largely the same, but the main use case is more
similar to the Home Manager option: to allow the use of nix-darwin
with an unmanaged system installation of Nix, including when there
is another service expecting to manage it, as with Determinate.

By providing an escape hatch to opt out of Nix management entirely,
this will also allow us to consolidate and simplify our existing Nix
installation management, by being more opinionated about things like
taking ownership of the daemon and the build users. Porting one option
from NixOS lets us drop two that only ever existed in nix-darwin and
reduce overall complexity.
2025-02-07 19:44:59 +00:00
Emily
1f7ed1c7fe checks: remove nixChannels check
I don’t think this is very important given the `nixPath` check,
and it doesn’t fit very well into a post‐user‐activation world.
2025-02-05 15:14:04 +00:00
tarc
f1cf8c4f5a checks: fix sw_vers parameter for macOSVersion (--productVersion, not -productVersion) 2025-01-30 12:46:25 -03:00
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
f43dac477e
Merge pull request #1280 from emilazy/push-tunoqoxyyuvy
{environment,readme}: default configuration path to `/etc/nix-darwin`
2025-01-28 02:14:28 +00:00
Emily
5c12a6f4a1
Merge pull request #1303 from emilazy/push-ulxuwyrnkwpq
{activation-scripts,activate-system}: purify environment
2025-01-27 23:11:51 +00:00
Emily
2733527a58 {environment,readme}: default configuration path to /etc/nix-darwin 2025-01-27 23:10:14 +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
Emily
2119dd10f6 checks: remove darwinChanges
It seems like this has been broken since
26bab2fd32 from 2018; macOS `diff(1)`
does not support these arguments and the `$PATH` has been fixed since
that point. Before that, it would presumably only have worked if you
added GNU diffutils to `environment.systemPackages`.

Proactively notifying users about breaking changes isn’t a bad idea,
but the activation script doesn’t seem like the right place for it,
and as it’s non‐blocking it’s likely that even if it worked it
would get drowned out by the later output anyway. I’d like to move
the changelog into release notes as part of the manual, which would
requires changes to this anyway. Since it’s been broken for almost
seven years anyway, let’s just drop it for now and revisit later.
2025-01-27 20:59:20 +00:00
Emily
65cc1fa8e3
Merge pull request #1283 from emilazy/push-nynpmzrmmozu
checks: remove `runLink`
2025-01-22 00:01:16 +00:00
Emily
c3954c51c4 checks: remove runLink
Now that we create `/run` as part of activation, this is no longer
useful for anaything.
2025-01-18 23:15:41 +00:00
Emily
e1976612f0 system: tweak ShellCheck settings 2025-01-18 19:34:21 +00:00
Emily
09414c7e2d
Merge pull request #1272 from emilazy/push-uooytqlwsquo
defaults-write: fix activation script conditionalization
2025-01-17 03:41:37 +00:00
Michael Hoang
ca1f666b6d
Merge pull request #1262 from belak-forks/additional-tiling-options
Add support for additional window tiling options
2025-01-17 14:28:18 +11:00
Michael Hoang
c738b81ff5
Merge pull request #1265 from emilazy/push-turlyykvtunt
checks: check for macOS ≥ 11.3
2025-01-17 14:03:04 +11:00
Kaleb Elwert
4075a3c23a Add support for additional window tiling options
This adds support for the following defaults:

- com.apple.WindowManager.EnableTilingByEdgeDrag
- com.apple.WindowManager.EnableTopTilingByEdgeDrag
- com.apple.WindowManager.EnableTilingOptionAccelerator
2025-01-15 22:53:21 -08:00
Emily
f959b8878b defaults-write: fix activation script conditionalization
These are lists, not attribute sets, so the condition was always
succeeding. As far as I can tell this bug has been present since the
function was added.
2025-01-16 00:13:57 +00:00
Emily
fe2fc038fd defaults/universalaccess: remove docs for macOS < 11 2025-01-14 15:56:20 +00:00
Emily
1c21c9410e system: remove unnecessary sudo 2025-01-14 15:56:20 +00:00
Emily
b721000dc6 system: add missing newline 2025-01-14 15:56:20 +00:00
Emily
ed6c4aabea system: remove code for macOS < 11 2025-01-14 15:56:20 +00:00
Emily
d5aeb4e5b1 checks: recommend sudo nix-channel 2025-01-14 01:19:21 +00:00
Emily
303a8143a4 checks: check for macOS ≥ 11.3 2025-01-12 19:43:29 +00:00
Emily
8a3ea966bc version: implement nix-darwin release versions 2025-01-11 15:35:09 +00:00
gnammix
89be82cb2b power: quote in string triggered shellcheck SC2016 2025-01-04 14:35:53 +01:00
Michael Hoang
3feaf376d7
Merge pull request #1241 from gnammix/power_conditional_setRestartPowerFailure
power: restartAfterPowerFailure option is carried out conditionally
2025-01-04 13:03:10 +11:00
gnammix
492a72007a
power: echo to print in error messages
Co-authored-by: Michael Hoang <Enzime@users.noreply.github.com>
2024-12-31 14:38:42 +01:00
gnammix
62d8f5f289 power: move the check for restartPowerfailure support to checks.nix 2024-12-29 12:13:54 +01:00
Filip Kania
b8e184ebf2
refactor: use enum as option type 2024-12-29 10:58:47 +01:00
Filip Kania
25fb527105
feat: add screencapture.target option 2024-12-29 00:17:19 +01:00
Austin Horstman
567bae1e17
defaults: expose-group-by-app -> expose-group-apps
Default was renamed in previous macOS release.
2024-12-01 19:12:41 -06:00
Beta-Computer
09e5dfb67e defaults: add EnableTiledWindowMargins option
Co-authored-by: Michael Hoang <Enzime@users.noreply.github.com>
2024-12-01 20:40:59 +11:00
Aiden Scandella
25e0b6064e
system: fix detection and ownership of /etc/synthetic.conf
This file is owned by root and mode 600 on my system, so the grep is
failing and it's adding a new entry every run.

```sh
-rw-------  1 root  wheel  664 Nov 25 15:52 /etc/synthetic.conf
```
2024-11-25 21:40:13 -08:00
Michael Hoang
57c144515a system: always add /run to /etc/synthetic.conf on macOS 10.15 onwards
Currently if nix-darwin is uninstalled then reinstalled without
rebooting, then the `/run` symlink will still remain and nix-darwin
won't readd `run` to `/etc/synthetic.conf` meaning the system will be
broken on next reboot.
2024-11-21 10:13:16 +11:00
isabel
fece297d64
fix: allow users to disable the homebrew check 2024-11-19 10:11:23 +00:00
Michael Hoang
34588d57cf
Merge pull request #879 from jtt9340/spaces-in-nixpath
fix broken NIX_PATH if paths contain spaces
2024-11-17 02:04:32 +00:00
Michael Hoang
6d794390fa checks: check single user installs don't have the nix-daemon enabled
Remove suggestion to set `nix.useDaemon` as it came without an
explanation of how the `nix-daemon` would be unmanaged and would most
likely lead to most users running an old version of Nix as the daemon.
2024-11-16 23:19:11 +11:00
Joey Territo
9077d812d8 activate-user script: fix broken NIX_PATH if paths contain spaces 2024-11-13 22:24:48 -06:00
Ameya Shenoy
67fbc7aa24 checks: add check to ensure Homebrew is installed
Co-Authored-By: Michael Hoang <enzime@users.noreply.github.com>
2024-11-13 09:53:17 +11:00
Lucas Mendes Loureiro
32df51bf2b fix(defaults): fixing #1107 2024-11-12 14:37:26 +00:00
Lucas Mendes Loureiro
d71aa30b41 feat(defaults): adding support to control center 2024-11-12 09:48:21 +00:00
Michael Hoang
fd510a7122 system: replace for f in $(ls ...) with for f in .../*
Fixes SC2045 but has one quirk which is if the bash glob doesn't match
anything it'll treat it as a string and run the loop once with
`f=.../*` so we need to check that `$f` actually exists.
2024-11-07 17:20:00 +11:00
Michael Hoang
041996803a treewide: fix shellcheck warnings and errors 2024-11-07 17:20:00 +11:00
Michael Hoang
9afef9950f checks: move manual /run instructions to activation 2024-11-07 17:15:22 +11:00
Michael Hoang
3ea1144938 system: run shellcheck on activate and activate-user scripts 2024-11-07 17:15:22 +11:00