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

1376 commits

Author SHA1 Message Date
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
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
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
Yifei Sun
d06cf700ee
homebrew: remove --no-lock flag
https://github.com/Homebrew/homebrew-bundle/pull/1630
2025-03-04 12:09:11 -05: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
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
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
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
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
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
Emily
cd445c5465 nix: catch reads of unmanaged defaults
When weā€™re not managing the Nix installation, these defaults
arenā€™t used out of the box and wonā€™t accurately represent the
state of any unmanaged Nix or the desired Nix package, so reading
the option defaults is a bug.

This was previously a warning for `nix.package` and a silent failure
for all the others. Now that all the problematic accesses in nix-darwin
have been appropriately conditionalized, and since a throw gives a
backtrace where a warning doesnā€™t, give throwing defaults to all the
`nix.*` options that donā€™t reflect reality and that that modules
shouldnā€™t be reading when `nix.enable` is off.

Iā€™m not in love with the implementation strategy hereā€¦ ideally
weā€™d think of something better than this and then upstream it to
NixOS. `nix.nrBuildUsers` growing a fake default that is never used
is particularly unfortunate. But this should hopefully catch mistakes
in module code reasonably reliably.
2025-02-11 20:10:55 +00:00
Emily
d677e3e844 nix-tools: only pass config.nix.nixPath through if nix.enable 2025-02-11 20:10:55 +00:00
Emily
42e16f31c6 cachix-agent: check for nix.enable 2025-02-11 20:10:55 +00:00
Emily
e3bde1588b github-runner: check for nix.enable 2025-02-11 20:10:55 +00:00
Emily
f4e2805e19 ofborg: check for nix.enable 2025-02-11 20:10:55 +00:00
Emily
aba0c60eba lorri: check for nix.enable 2025-02-11 20:10:55 +00:00
Emily
57c93ffe6c hercules-ci-agent: check for nix.enable 2025-02-11 20:10:55 +00:00
Emily
147ed950e3 nixpkgs-flake: check for nix.enable 2025-02-11 20:10:55 +00:00
Emily
7cca8f95f7 linux-builder: check for nix.enable 2025-02-11 20:10:55 +00:00
Emily
0176a5082b nix-optimise: check for nix.enable
This was added to Nixpkgs in eb8b70c020e6693b29634660fa173d7f14f882eb.
2025-02-11 20:10:55 +00:00
Emily
fc9367a9ec nix-gc: check for nix.enable
This was added to Nixpkgs in eb8b70c020e6693b29634660fa173d7f14f882eb.
2025-02-11 20:10:55 +00:00
Emily
a6746213b1
Merge pull request #1313 from emilazy/push-tzwxwyvonslk
nix: add `nix.enable` option to disable Nix management
2025-02-11 19:30:41 +00:00
Emily
a36049dac5
Merge pull request #1329 from emilazy/push-nlxwnqymuupk
homebrew: use `mas` from Nixpkgs
2025-02-10 23:20:29 +00:00
Emily
0b6f96a6b9
Merge pull request #1322 from emilazy/push-trvmqywuwnop
Revert "nixpkgs: make config.nixpkgs.{buildPlatform,hostPlatform} write only"
2025-02-08 17:03:44 +00:00
Emily
c31b6e8a03 homebrew: use mas from Nixpkgs
Currently, setting `homebrew.masApps` causes `"mas"` to automatically
be added to `homebrew.brews`. Users who want to use Homebrew only
for managing App Store apps and casks, like me, can override this
by setting `homebrew.brews = lib.mkForce [ ];` and adding Nixpkgsā€™
`mas` to their `environment.systemPackages`.

When the activation script path no longer depends on the built
configurationā€™s `environment.systemPackages`, this will no longer
work. Since this was originally added before `mas` was packaged in
Nixpkgs and we now have a perfectly serviceable binary package,
we can add it to the `$PATH` when invoking Homebrew and skip the
automatic formula installation.

As the Homebrew `bin` directory still comes first, users who
specifically want the formula can restore the previous behaviour by
explicitly adding `"mas"` to `homebrew.brews`.

Closes: #1314
2025-02-08 16:18:38 +00:00
Emily
3f4351d233
Merge pull request #1327 from emilazy/push-vunnqlmqnzts
checks: fix macOS version check exit code
2025-02-08 14:32:00 +00:00
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
8a94b5b99b nix-daemon: remove services.nix-daemon.enable
We now manage the launchd daemon unconditionally when we manage the
Nix installation.
2025-02-07 19:44:59 +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