From 3bd914a002d5ad0896a900e614d1f0cabd255cc5 Mon Sep 17 00:00:00 2001 From: imbytecat Date: Sat, 11 Apr 2026 00:56:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=BF=81=E7=A7=BB=20macOS=20=E5=88=B0?= =?UTF-8?q?=20Lix=EF=BC=8C=E7=BB=9F=E4=B8=80=E5=85=A8=E5=B9=B3=E5=8F=B0=20?= =?UTF-8?q?nix=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 替换 Determinate Nix 为 Lix (pkgs.lix),移除 nix.enable 条件判断,nix.settings 现在统一应用于所有设备。更新 AGENTS.md 和 README.md 文档。 --- .sisyphus/ralph-loop.local.md | 15 --------------- AGENTS.md | 36 +++++++++-------------------------- README.md | 4 +--- home/shell/fish.nix | 2 +- modules/shared/nix.nix | 7 +++---- 5 files changed, 14 insertions(+), 50 deletions(-) delete mode 100644 .sisyphus/ralph-loop.local.md diff --git a/.sisyphus/ralph-loop.local.md b/.sisyphus/ralph-loop.local.md deleted file mode 100644 index 4454b72..0000000 --- a/.sisyphus/ralph-loop.local.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -active: true -iteration: 3 -max_iterations: 500 -completion_promise: "VERIFIED" -initial_completion_promise: "DONE" -verification_attempt_id: "89113c03-711f-4bdb-a42c-710b7726f431" -started_at: "2026-04-10T15:59:34.105Z" -session_id: "ses_28863d32affeOW6Iiz2415uZSk" -ultrawork: true -verification_pending: true -strategy: "continue" -message_count_at_start: 191 ---- -Complete the task as instructed diff --git a/AGENTS.md b/AGENTS.md index 44d39ca..24b51f4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -14,15 +14,22 @@ flake.nix ``` - `lib/default.nix` — builders: `mkDarwin`, `mkNixos`, `mkHome` -- `modules/shared/` — both platforms (nixpkgs config, overlays) +- `modules/shared/` — both platforms (nixpkgs config, overlays, nix settings) - `modules/darwin/` — macOS: system preferences, homebrew (casks/brews/masApps), fonts - `modules/nixos/` — NixOS: base packages, docker, locale, user - `home/` — home-manager (shared across all hosts via `useGlobalPkgs`) - `overlays/` — custom packages (comment-checker) +## Nix implementation + +All platforms use **Lix** (`nix.package = pkgs.lix` in `modules/shared/nix.nix`). Lix is a community fork of CppNix — same CLI, different implementation (partial Rust rewrite, ~20-30% faster, better error messages). + +- macOS installed via [Lix installer](https://lix.systems/install/) +- `nix.enable = true` on all platforms — nix-darwin fully manages the Nix daemon, `/etc/nix/nix.conf`, and `nix.settings` +- `nix.settings` (flakes, warn-dirty) applies uniformly across all 3 devices + ## Critical gotchas -- **Determinate Nix on macOS (tech debt)**: macOS currently runs Determinate Nix (commercial downstream). `modules/shared/nix.nix` sets `nix.enable = !pkgs.stdenv.isDarwin` — on darwin, nix-darwin does NOT manage: nix daemon, `/etc/nix/nix.conf`, nix version, `nix.settings`. All nix configuration on macOS is controlled by Determinate's `determinate-nixd`. The `nix.settings` block (flakes, warn-dirty) only applies on NixOS/WSL. **nix-darwin officially recommends Lix installer (not Determinate) as of 2025-12.** README already updated to recommend Lix for new installs. Migration to Lix would restore `nix.enable = true` and unified `nix.settings` across all 3 devices. - **catppuccin.nvim disabled**: `catppuccin.nvim.enable = false` in `home/theme.nix` due to `catppuccin.lib.detect_integrations` require check failure in nixpkgs. Re-test periodically. - **catppuccin module name**: Uses `catppuccin.homeModules.catppuccin` (not the old `homeManagerModules`). - **Homebrew tap casks**: Casks from taps need full path in the casks list (e.g. `"goooler/repo/fl-clash"`), not just the short name. @@ -75,28 +82,3 @@ Uses `nixd` (not `nil`). nixd provides nixpkgs/option completion; nil does not. ## Formatter `nixfmt` (was `nixfmt-rfc-style`, now unified). Run: `nixfmt ` - -## Nix installer situation (as of 2025-12) - -macOS currently uses **Determinate Nix** (installed via `install.determinate.systems`). This is a commercial downstream of Nix by Determinate Systems with extras (lazy trees, parallel eval, FlakeHub). - -**Why this matters**: Determinate runs its own daemon (`determinate-nixd`), conflicting with nix-darwin's native nix management. This forces `nix.enable = false` on darwin, splitting nix config across two owners: - -| What | macOS (Determinate manages) | NixOS/WSL (nix-darwin manages) | -|------|---|---| -| nix daemon | `determinate-nixd` | nix-darwin | -| `/etc/nix/nix.conf` | Determinate | nix-darwin via `nix.settings` | -| flakes enabled | Determinate default | `nix.settings.experimental-features` | -| nix version | Determinate auto-update | nixpkgs pin | - -**nix-darwin maintainer stance** (issue #1632, PR #1659, 2025-12): *"We explicitly recommend upstream Nix over Determinate Nix."* README now only recommends Lix installer. - -**Migration path to Lix** (if/when decided): -1. `/nix/nix-installer uninstall` (Determinate's uninstaller) -2. `curl -sSf -L https://install.lix.systems/lix | sh -s -- install` -3. Remove `nix.enable` conditional in `modules/shared/nix.nix` (let it default to true) -4. `nix.settings` will then apply to all platforms -5. Update `README.md` install command -6. Lix is a community fork of Nix — same CLI (`nix build`, `nix flake`), different implementation (partial Rust rewrite, ~20-30% faster) - -**Key distinction**: "Lix installer" is the install tool; "Lix" is the Nix implementation you run after. They are a package deal — using the Lix installer means running Lix (not upstream Nix). diff --git a/README.md b/README.md index e1423a6..215556a 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,12 @@ ### macOS (Mac Mini / MacBook Air) -1. 安装 Nix(推荐 [Lix 安装器](https://lix.systems/install/)): +1. 安装 [Lix](https://lix.systems/)(Nix 的社区分支,nix-darwin 官方推荐): ```bash curl -sSf -L https://install.lix.systems/lix | sh -s -- install ``` -> **注意**:当前机器使用 Determinate Nix,需要 `nix.enable = false`(已在 `modules/shared/nix.nix` 中配置)。新机器建议使用 Lix,可省去此限制。详见 `AGENTS.md`。 - 2. 克隆仓库并首次构建: ```bash diff --git a/home/shell/fish.nix b/home/shell/fish.nix index 0941ad3..942d3a2 100644 --- a/home/shell/fish.nix +++ b/home/shell/fish.nix @@ -43,7 +43,7 @@ # Platform-specific rebuild command (derive flake attr from hostname) if test (uname) = Darwin - set -l attr (scutil --get LocalHostName | string lower | string replace 'awesome-' '') + set -l attr (scutil --get LocalHostName | string lower | string replace 'awesome-' "") abbr --add rebuild "sudo darwin-rebuild switch --flake ~/Developer/nix-config#$attr" else abbr --add rebuild "sudo nixos-rebuild switch --flake ~/Developer/nix-config#wsl" diff --git a/modules/shared/nix.nix b/modules/shared/nix.nix index cefb94c..ed38dfb 100644 --- a/modules/shared/nix.nix +++ b/modules/shared/nix.nix @@ -1,10 +1,9 @@ -{ lib, pkgs, ... }: +{ pkgs, ... }: { - # Determinate Nix manages the daemon on macOS - nix.enable = !pkgs.stdenv.isDarwin; + nix.package = pkgs.lix; - nix.settings = lib.mkIf (!pkgs.stdenv.isDarwin) { + nix.settings = { experimental-features = [ "nix-command" "flakes"