Commit graph

2298 commits

Author SHA1 Message Date
Michael Hoang
f6b29e4af8 defaults: support AppleKeyboardUIMode = 2 for newer macOS versions 2025-06-04 11:02:16 +10:00
Michael Hoang
d46a07214f
Fix ShellCheck escaped character issue in nixPath check (#1500) 2025-06-04 00:56:23 +00:00
Ethan Turkeltaub
b07a4c8be5
Fix ShellCheck issue in nixPath check 2025-06-03 16:19:03 -04:00
Adam C. Stephens
7c284a6504
Avoid confusing users with future deprecations 2025-06-02 09:55:31 -04:00
Emily
44a7d0e687
darwin-rebuild: use NIX_REMOTE=daemon even as root (#1458) 2025-05-27 13:33:47 +00:00
Michael Hoang
a9939228f6
config/system-path: restructure to mirror NixOS (#1481) 2025-05-25 05:00:28 +00:00
Michael Hoang
9f609d1d9f
ci: enable merge queue (#1482) 2025-05-25 04:31:32 +00:00
Michael Hoang
0d3dcc55f3 ci: enable merge queue 2025-05-25 14:14:52 +10:00
Michael Hoang
cd6a8a796d config/system-path: restructure to mirror NixOS
2795c506fe/nixos/modules/config/system-path.nix
2025-05-25 14:06:56 +10:00
Michael Hoang
e0a7c37735
config/terminfo: init module (#1479) 2025-05-25 09:50:52 +10:00
Michael Hoang
5374405a01 config/terminfo: init module 2025-05-25 09:24:12 +10:00
Michael Hoang
acd6aa5a90
programs/arqbackup: init module (#1474) 2025-05-24 15:40:10 +10:00
Michael Hoang
7347f72507 programs/arqbackup: init module 2025-05-24 15:16:24 +10:00
Robert Hensing
30845beee0 nix.nixPath: Do not use environment.darwinConfig if set to null
I've personally set it to `null` to make my `system.primaryUser = null;`
configuration work on a machine with `stateVersion = 4;`.

It may apply in other use cases as well.
2025-05-23 16:51:36 +02:00
Emily
33220d4791
system.build: Treat as variables, make lazy, fix error message (#1468) 2025-05-23 13:44:11 +01:00
Robert Hensing
acf6b46011 system.build: Treat as variables, make lazy
This fixes an unnecessary evaluation dependency that prevented the
custom and much appreciated primaryUser error from popping up.

Specifically:

       … while evaluating the option `system.build':

       … while evaluating definitions from `/nix/store/lc6n4bhxj9255kzfn9pnpx65583a8cgc-source/modules/environment':

       … while evaluating definitions from `/nix/store/lc6n4bhxj9255kzfn9pnpx65583a8cgc-source/modules/nix':

       … while evaluating the option `environment.darwinConfig':

       … while evaluating the option `system.primaryUserHome':

       error: expected a string but found null: null
       at /nix/store/lc6n4bhxj9255kzfn9pnpx65583a8cgc-source/modules/system/primary-user.nix:26:30:
           25|       default =
           26|         config.users.users.${config.system.primaryUser}.home or "/Users/${config.system.primaryUser}";
             |                              ^
           27|     };

While it did have some indication as to the cause, it lets the good
error message go to waste.

**Context**

`lazyAttrsOf` is the better choice when you use an attrset as individual
variables instead of in aggregate (e.g. `attrNames`, `toJSON`).

The reason is that an expression like `a.b` is strict in `a`, which
entails the evaluating the _whole_ set of attribute _names_ in `a`.
In the `attrsOf` this means evaluating all `mkIf` conditions, which
in turn also means evaluating all the regular definitions to the
smallest degree (WHNF) to determine that they're not `mkIf`s.

`lazyAttrsOf` simply assumes that all attributes aren't `mkIf false`,
and throws an error in the attribute value if necessary.
This would be a problem with `toJSON` and such, but is completely
fine when the attributes are treated as variables of a lazy program,
as is the case here.

**NixOS**

NixOS made `system.build` a submodule with a `freeformType`, allowing
the things inside of it to be declared, and for them to have niceties
like documentation and merging behavior.
nix-darwin could probably adopt this.
2025-05-23 12:00:51 +02:00
Michael Hoang
93562b65cf
feat(services.openssh): add extraConfig option (#1465) 2025-05-23 01:41:14 +00:00
squat
0e3b855456
add test
Signed-off-by: squat <lserven@gmail.com>
2025-05-23 02:58:23 +02:00
squat
e09c1aefe4
feat(services.openssh): add extraConfig option
Same interface as in NixOS: https://search.nixos.org/options?channel=unstable&show=services.openssh.extraConfig&from=0&size=50&sort=relevance&type=packages&query=services.openssh.extraConfig
This is useful to customize the behavior of the SSH daemon, e.g. to add
options like `StreamLocalBindUnlink yes` to improve gpg-agent
forwarding.

Signed-off-by: squat <lserven@gmail.com>
2025-05-22 20:22:47 +02:00
Michael Hoang
e2676937fa
flake.lock: update (#1463) 2025-05-21 09:36:44 +00:00
Emily
0b5fee1285 flake.lock: update
Should fix the website build.
2025-05-21 10:05:49 +01:00
Emily
9ed53ae9ab
version: bump to 25.11 (#1449) 2025-05-20 15:45:13 +01:00
Emily
d23a9c26f3 darwin-rebuild: use NIX_REMOTE=daemon even as root 2025-05-19 18:26:49 +01:00
Michael Hoang
b9b927dd1f
Update repo links (#1450) 2025-05-18 08:45:43 +10:00
Siddhartha Sahu
24952f03f9
Update default.nix 2025-05-17 12:15:49 -04:00
Siddhartha Sahu
58f268e065
Update CHANGELOG 2025-05-17 12:15:18 -04:00
Siddhartha Sahu
a4cc54778d
Update repo link 2025-05-17 12:14:14 -04:00
Emily
0c0f423db8 version: bump to 25.11 2025-05-17 16:06:23 +01:00
Emily
8e251e4534
The Plan, phase 1 (#1341) 2025-05-17 16:02:22 +01:00
Emily
b9e580c113 changelog: document user activation removal 2025-05-16 16:34:31 +01:00
Emily
a0e4dd2af9 activation-scripts: move createRun after checks
The checks should no longer depend on `/run`, so this avoids modifying
the system before they run.
2025-05-16 16:34:31 +01:00
Emily
7e5c6f7e21 etc: merge etcChecks into checks
The `activate-system` daemon will now run all the checks, which seems
like probably a good idea anyway?
2025-05-16 16:34:31 +01:00
Emily
af62c4d176 checks: make nixPath check more helpful 2025-05-16 16:34:31 +01:00
Emily
051283a895 {activation-scripts,activate-system}: purify environment again 2025-05-16 16:34:31 +01:00
Emily
516dbe1fa4 darwin-rebuild: require running as root 2025-05-16 16:34:31 +01:00
Emily
40d2a159cc tests: remove stray activate-user references 2025-05-16 16:34:31 +01:00
Emily
2ca294741f activation-scripts: get rid of user activation
🎉

Closes: #96
2025-05-16 16:34:31 +01:00
Emily
0abf012666 users: refuse to delete the primary user 2025-05-16 16:31:17 +01:00
Emily
bed70a84af {environment,nix}: remove references to $HOME
These can’t be relied upon in a post‐user‐activation
world. Technically a breaking change, if anyone has their home
directory outside of `/Users` or is using `root` for this, but, well,
I did my best and these are legacy defaults anyway.
2025-05-16 16:31:17 +01:00
Emily
2892da83ea applications: use system.primaryUser for the legacy path
System activation scripts shouldn’t (and soon won’t be able to)
rely on `$HOME` being the primary user’s.
2025-05-16 16:31:17 +01:00
Emily
f47b8062cb defaults: move userDefaults to system activation 2025-05-16 16:31:17 +01:00
Emily
7877cba5f5 launchd: move userLaunchd to system activation
I’m not *completely* certain that this handles user agents
correctly. There is a deprecated command, `launchctl asuser`, that
executes a command in the Mach bootstrap context of another user`.
<https://scriptingosx.com/2020/08/running-a-command-as-another-user/>
claims that this is required when loading and unloading user agents,
but I haven’t tested this. Our current launchd agent logic is pretty
weird and broken already anyway, so unless this actively regresses
things I’d lean towards keeping it like this until we can move
over entirely to `launchctl bootstrap`/`launchctl kickstart`, which
aren’t deprecated and can address individual users directly. Someone
should definitely test it more extensively than I have, though.
2025-05-16 16:29:17 +01:00
Emily
c449918bfb homebrew: move to system activation
This adds an optional explicit `homebrew.user` option that allows users
to avoid setting `system.primaryUser`, partly as a proof of concept
of what the interfaces should look like in the future. Homebrew only
officially support one global installation, so a singleton matches
upstream’s expectations; in practice, it may be useful for us to
nest this into `users.users.*.homebrew` instead, at the expense of
being an unsupported setup if used to its full potential. Since
that would be a breaking change to the inteface anyway, I think
adding `homebrew.user` for now is acceptable. (I think one native
Apple Silicon and one Rosetta 2 Homebrew installation – under
`/opt/homebrew` and `/usr/local` respectively – may be exceptions
to this lack of upstream support, but that would be complicated to
support even with `users.users.*.homebrew`.)

I’m not entirely sure where in system activation this should
go. Probably after the user defaults and launch agents stuff, to match
the existing logic in user activation, and I lean towards doing it
as late as possible; too early and we might not have the users and
groups required to bootstrap a Homebrew installation set up, but
as Homebrew installations could be fiddly and fail, doing it in the
middle could leave a partially‐activated system.

Probably it should be done in a launch agent or something instead, but
this is my best guess as to the appropriate place for now. The downside
is that activation scripts generally won’t be able to assume that the
Homebrew prefix is populated according to the current configuration,
but they probably shouldn’t be depending on that anyway?
2025-05-16 16:29:17 +01:00
Emily
52ee8c57c2 primary-user: init 2025-05-16 16:29:17 +01:00
Michael Hoang
8817b00b00
defaults: add com.apple.iCal for managing Calendar.app (#1446) 2025-05-16 13:12:40 +10:00
Michael Hoang
14737a9676 defaults: add com.apple.iCal for managing Calendar.app 2025-05-16 12:52:49 +10:00
Michael Hoang
b6fff20c69
defaults: update docs for AppleInterfaceStyle (#1445) 2025-05-15 18:28:21 +10:00
Michael Hoang
d693997a32 defaults: update docs for AppleInterfaceStyle
Eventually we should implement a special type that allows deleting
values.
2025-05-15 18:02:47 +10:00
Michael Hoang
f0fbf2dbe7
_1password{,-gui}: fix package not being used (#1444) 2025-05-15 17:29:56 +10:00
Michael Hoang
f2753a4ca6 _1password{,-gui}: fix package not being used 2025-05-15 17:01:26 +10:00