2025-05-31

My Computer Broke Without Me Doing Anything

Nix
Notes
This article was translated by GPT-5.2-Codex. The original is here.

My computer broke without me doing anything.

It sounds like something an engineer should never say, but my computer (environment) broke without me doing anything.

Nix

I use a package management system called Nix to set up my PC environment. I'll leave the passionate explanations of why Nix is great to others on the internet, but in the past few weeks, my Nix-managed environment broke. To be precise, package updates stopped working.

I said Nix, but since I'm on macOS, the exact stack is:

In this environment, running sudo darwin-rebuild switch --flake started failing a few weeks ago with this error.

Because of this, I can no longer install or update applications.

As the error message indicates, the environment is currently recognized as arm64-apple-darwin.

This was about to affect my work, so I investigated and found relevant GitHub issues. It looks like it may take time to resolve.

System name change

It seems the root cause was a PR in NixOS/nixpkgs: lib/systems: use Darwin architecture names for config and uname by emilazy · Pull Request #393213 · NixOS/nixpkgs.

Previously, ARM 64-bit macOS (Apple Silicon) was treated as aarch64-apple-darwin, but this PR changed it to arm64-apple-darwin. This change itself is to align with LLVM 20 changes, so the biggest culprit is LLVM.

I hadn't been conscious of the naming differences between AArch64 and arm64, but in the LLVM context, as LLVM backend differences between aarch64 and arm64 - Embedded person explains, AArch64 is created by ARM, while ARM64 is created by Apple. That article mentions a move to unify on AArch64, but perhaps time passed and they diverged again.

Indeed, running uname -m locally shows arm64.

This mismatch is likely what they wanted to resolve, but it caused packages to fail to build.

Looking at these PRs and issues, packages that hard-coded architecture strings instead of using stdenv.hostPlatform.config, or packages using stdenv.hostPlatform.darwinArch, seem to be affected.

Solution

Under investigation. It seems we just have to wait for nixpkgs to catch up. Not all packages should be broken, so we may need to identify the specific package causing it.

Cause found: I had installed copilot-language-server. This matches the issue below.

Since I manage Emacs packages with Nix, copilot-language-server was pulled in along with copilot.el. Temporarily removing copilot.el resolved the issue.

Conclusion

Fix it soon, please.