Skip to content

Commit

Permalink
Fix: Build errors on Sequoia (#143)
Browse files Browse the repository at this point in the history
* Fix: The option definition `nix.gc.user' and `services.nix-daemon.enable' no longer has any effect

When running `nix run .#build` on macOS Sequoia, the following error was occurred:

```
error:
       … while evaluating the attribute 'value'
         at /nix/store/zbvf6xwri9kvf42xl3vai3mx8jry6ax8-source/lib/modules.nix:853:9:
          852|     in warnDeprecation opt //
          853|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          854|         inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build':

       … while evaluating the attribute 'mergedValue'
         at /nix/store/zbvf6xwri9kvf42xl3vai3mx8jry6ax8-source/lib/modules.nix:888:5:
          887|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          888|     mergedValue =
             |     ^
          889|       if isDefined then

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

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error:
       Failed assertions:
       - The option definition `nix.gc.user' in `/nix/store/zkkcgy73xlq8p4vk46jrxs0rm02aq8zx-source/hosts/darwin' no longer has any effect; please remove it.
       The garbage collection service now always runs as `root`.

       - The option definition `services.nix-daemon.enable' in `/nix/store/zkkcgy73xlq8p4vk46jrxs0rm02aq8zx-source/hosts/darwin' no longer has any effect; please remove it.
       nix-darwin now manages nix-daemon unconditionally when
       `nix.enable` is on.
```

After making the amendments as advised, the issue was resolved.

* Repair/Reinstall Instructions for Sequoia

The `nix run .#build-switch` command failed with the following error on Sequoia as Nix was installed after upgrading from Sonoma.

```
error: Build user group has mismatching GID, aborting activation
The default Nix build user group ID was changed from 30000 to 350.
You are currently managing Nix build users with nix-darwin, but your
nixbld group has GID 350, whereas we expected 30000.

Possible causes include setting up a new Nix installation with an
existing nix-darwin configuration, setting up a new nix-darwin
installation with an existing Nix installation, or manually increasing
your `system.stateVersion` setting.

You can set the configured group ID to match the actual value:

    ids.gids.nixbld = 350;

We do not recommend trying to change the group ID with macOS user
management tools without a complete uninstallation and reinstallation
```

The root cause is mentioned in https://determinate.systems/posts/nix-support-for-macos-sequoia/, which had to be done prior to  the upgrade. Since the upgrade was already done, the fix is to reinstall Nix with expected GID for `nixbld`.

* Fix: Spelling and grammar

A few typos have ben fixed.
  • Loading branch information
aloshy-ai authored Feb 25, 2025
1 parent 4533350 commit b54201b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ After installation, open a new terminal session to make the `nix` executable ava

> [!IMPORTANT]
>
> If planning to upgrade to Sequoia, [prepare Nix](https://determinate.systems/posts/nix-support-for-macos-sequoia/) before proceeding.
>
> If using [the official installation instructions](https://nixos.org/download) instead, [`flakes`](https://nixos.wiki/wiki/Flakes) and [`nix-command`](https://nixos.wiki/wiki/Nix_command) aren't available by default.
>
> You'll need to enable them.
Expand Down Expand Up @@ -279,6 +281,19 @@ nix run .#build
> ```
> Backup and move the files out of the way and/or edit your Nix configuration before continuing.
> [!WARNING]
> You may encounter `error: Build user group has mismatching GID, aborting activation` if you have already upgraded to Sequoia but haven't had [prepared Nix](https://determinate.systems/posts/nix-support-for-macos-sequoia/) before that.
> The error will list the files like this:
>
> ```
> error: Build user group has mismatching GID, aborting activation
> The default Nix build user group ID was changed from 30000 to 350.
> You are currently managing Nix build users with nix-darwin, but your
> nixbld group has GID 350, whereas we expected 30000.
> ```
>
> You will have to [uninstall Nix](https://zero-to-nix.com/start/uninstall/), and [install Nix](https://zero-to-nix.com/start/install/) again with `--nix-build-group-id 30000` flag.
### 10. Make changes
Finally, alter your system with this command:
```sh
Expand Down
4 changes: 2 additions & 2 deletions hosts/darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let user = "dustin"; in
];

# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
# services.nix-daemon.enable = true;

# Setup user, packages, programs
nix = {
Expand All @@ -25,7 +25,7 @@ let user = "dustin"; in
};

gc = {
user = "root";
# user = "root";
automatic = true;
interval = { Weekday = 0; Hour = 2; Minute = 0; };
options = "--delete-older-than 30d";
Expand Down

0 comments on commit b54201b

Please sign in to comment.