1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-04-07 01:23:59 +00:00
Commit graph

2124 commits

Author SHA1 Message Date
Emily
ca0c46ace5 {activation-scripts,activate-system}: purify environment again 2025-03-23 11:55:36 +00:00
Emily
d07feb43b2 nix-tools: re‐add nixPackage
(With some tweaks to handle `nix.enable` and order it at a more
sensible position in the `$PATH`.)

The installers actually install Nix into `root`’s profile for some
reason, which means that the path’s prioritization backfires when
the script runs as root and we’re managing the Nix installation. When
running `darwin-rebuild` as a normal user, this wasn’t a problem.

Maybe we should just have a check to make sure there’s no conflicting
Nix in `root`’s profile – it seems pretty bad for `root` to
get the wrong Nix – but it would trigger for almost everyone,
which seems kind of annoying. I guess we could automatically
remove it from `root`’s profile if it matches what’s in
`/nix/var/nix/profiles/default`…

This reverts commit 02232f71c5.
2025-03-23 11:55:36 +00:00
Emily
1008b7d492 darwin-rebuild: require running as root 2025-03-23 11:55:36 +00:00
Emily
2c4fc49f45 tests: remove stray activate-user references 2025-03-23 11:55:36 +00:00
Emily
c8660d0aa4 activation-scripts: get rid of user activation
🎉

Closes: #96
2025-03-23 11:55:36 +00:00
Emily
52026cf3eb users: refuse to delete the primary user 2025-03-23 11:55:36 +00:00
Emily
424ac85232 {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-03-23 11:55:36 +00:00
Emily
dee253cf56 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-03-23 11:55:36 +00:00
Emily
bc00d06ce0 defaults: move userDefaults to system activation 2025-03-23 11:55:36 +00:00
Emily
56d8208c45 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-03-23 11:13:48 +00:00
Emily
73a6ceda1b 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-03-23 11:13:48 +00:00
Emily
e0c3c3e7f8 primary-user: init 2025-03-23 11:13:48 +00:00
Emily
e9f41de2a8
Merge pull request #1375 from dwt/fix-docs-2
Docs: Fix references to NixOS
2025-03-21 22:10:55 +00:00
Michael Hoang
2d9b633169
Merge pull request #1331 from isabelroses/tools
feat: system tools can be configured individually
2025-03-19 17:35:36 +09:00
Michael Hoang
95eac71bf5
Merge pull request #1386 from Enzime/push-lnuotyxsytkz
Back out "github-runner: replace `mkdir -p -m` with `umask`"
2025-03-17 07:58:43 +09:00
Michael Hoang
7b4a4951dc Back out "github-runner: replace mkdir -p -m with umask"
This backs out commit 3b738c765d.

Setting a `umask` made the parent directory have too conservative of
permissions making it so `_github-runner` couldn't access the child
directories.
2025-03-16 19:31:31 +09:00
isabel
9951b44d5b
nix-darwin: system tools can be configured indvidually 2025-03-15 09:24:22 +00:00
Michael Hoang
9175b4bb5f
Merge pull request #1377 from zhaofengli/fix-custom-user-preferences-merging
Fix merging of system.defaults.CustomUserPreferences
2025-03-15 13:46:20 +09:00
Zhaofeng Li
814b503899 Fix merging of system.defaults.CustomUserPreferences 2025-03-14 12:00:17 -06:00
Michael Hoang
4d8a451649
Merge pull request #1355 from toodeluna/fix/profile-name
fix: use correct username for profile
2025-03-14 07:46:59 +09:00
Michael Hoang
2fb6b09b67
Merge pull request #1089 from niklasravnsborg/fix-modules-commands
Update nextdns to use `command`
2025-03-13 00:47:09 +09:00
Niklas Ravnsborg
feecfd97cd
update nextdns to use command instead of serviceConfig.ProgramArguments 2025-03-12 15:52:45 +01:00
Luna Heyman
9ddb2e6ca7 fix: use correct username for profile 2025-03-10 19:55:24 +01:00
‮rekcäH nitraM‮
d97323bc60 Docs: Fix references to NixOS
This option applies to nix-darwin.
2025-03-06 16:24:46 +01:00
Michael Hoang
adf5c88ba1
Merge pull request #1367 from Enzime/push-wmqtrnkuqvrt
readme: update instructions as Determinate Nix is now the default
2025-03-06 11:45:00 +09:00
Michael Hoang
df599ea8f1 readme: update instructions as Determinate Nix is now the default 2025-03-05 11:25:30 +09:00
Emily
991bb2f6d4
Merge pull request #1362 from stepbrobd/master
homebrew: remove `--no-lock` flag
2025-03-04 18:17:28 +00:00
Yifei Sun
d06cf700ee
homebrew: remove --no-lock flag
https://github.com/Homebrew/homebrew-bundle/pull/1630
2025-03-04 12:09:11 -05:00
Michael Hoang
4a0bddd498
Merge pull request #1359 from amarshall/fix-dnscrypt-proxy-alias
services/dnscrypt-proxy: Fix use of pkg alias
2025-03-04 08:13:50 +09:00
Andrew Marshall
fdc512d107 services/dnscrypt-proxy: Fix use of pkg alias
`dnscrypt-proxy2` is just an alias for `dnscrypt-proxy`. Use that and
avoid eval failures when Nixpkgs is configured with `allowAliases =
false`.
2025-03-03 08:13:33 -05:00
Michael Hoang
5d6e0851b6
Merge pull request #1343 from r17x/feat/dnscrypt-proxy
services/dnscrypt-proxy: init
2025-02-28 22:15:25 +07:00
r17x
7386d8878e
services/dnscrypt-proxy: init 2025-02-28 19:58:19 +07:00
Michael Hoang
665cc04a60
Merge pull request #1216 from Coosis/master
Add `pam-watchid` authentication to `sudo` command
2025-02-27 13:09:12 +07:00
Emily
31631ea68f
Merge pull request #1353 from booxter/revert-939-networking_hosts
Revert "Add networking.hosts and .hostFiles from nixos "
2025-02-26 23:50:21 +00:00
Ihar Hrachyshka
b1db30ce36 networking: Restore the original /etc/hosts on activation
A patch that replaced the original file with a symlink to nix store was
reverted because MacOS Network framework doesn't support symlinks for
the file.

The revert leaves the system without any /etc/hosts file at all though.
To fix this, an activation step is added to restore the original file
from .before-nix-darwin backup, if it exists.

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
2025-02-26 16:52:13 -05:00
Ihar Hrachyshka
1d9f622484
Revert "Add networking.hosts and .hostFiles from nixos " 2025-02-26 09:24:15 -05:00
Coosis
727119f8c7 pam: add pam_watchid support 2025-02-25 23:51:30 +08:00
Michael Hoang
42be12b510
Merge pull request #1344 from Mic92/fix_pam_module
fix: move `pam` configuration to `sudo_local`
2025-02-25 10:06:11 +07:00
Michael Hoang
59efa72d69
Merge pull request #939 from ibizaman/networking_hosts
Add networking.hosts and .hostFiles from nixos
2025-02-25 09:54:13 +07:00
Michael Hoang
11ea44f3e2 pam: add pam_reattach support
Co-Authored-By: Andrew Lubawy <andrew@andrewlubawy.com>
2025-02-25 09:47:28 +07:00
Michael Hoang
47f263077e pam: switch to using sudo_local file
Co-Authored-By: Andrew Lubawy <andrew@andrewlubawy.com>
2025-02-25 09:47:28 +07:00
ibizaman
bde9fa6f64 add networking.hosts and .hostFiles from nixos 2025-02-24 08:57:05 +01:00
Michael Hoang
c9c2d40f71 pam: remove with lib; 2025-02-20 17:46:49 +07:00
Emily
6ab392f626
Merge pull request #1187 from khaneliman/spacer
dock: allow setting spacer tiles
2025-02-19 02:57:52 +00:00
Austin Horstman
e21d07988b
dock: refactor persistent-apps option 2025-02-17 13:12:40 -06:00
Austin Horstman
02ba211ea1
dock: allow setting tile-types
You can create spacer tiles in the dock by passing empty tile-data with
specific tile-types
2025-02-16 19:26:43 -06:00
Emily
678b22642a
Merge pull request #1332 from emilazy/push-vyxwvkuuvvvw
treewide: add checks for `nix.enable`
2025-02-14 15:50:17 +00:00
Michael Hoang
7206892913
Merge pull request #1337 from sandydoo/fix-extra-nix-conf
nix: place `extra-`prefixed settings after their non-prefixed variants
2025-02-14 21:15:10 +07:00
Sander
5926058aec
nix: place extra-prefixed settings after their non-prefixed variants
Fixes #626.

Essentially a copy of NixOS's workaround: https://github.com/NixOS/nixpkgs/pull/278064
2025-02-14 16:33:12 +04:00
Emily
731910af01 {activation-scripts,activate-system}: check gcroots before linking
When `nix.enable` is off, we don’t necessarily have an active
Nix installation, so there won’t necessarily be an active
`/nix/var/nix/gcroots` directory to link things into. NixOS just skips
this unconditionally when `nix.enable` is off, but that doesn’t
work well with a context in which we usually expect `nix.enable`
to be coupled with an unmanaged system installation of Nix.
2025-02-11 20:10:55 +00:00