From f9d5c70fb149c03a4d99e65ad090cc299a99cfc7 Mon Sep 17 00:00:00 2001 From: OlivierChiasson Date: Thu, 4 Jun 2026 16:40:12 -0300 Subject: [PATCH] Refactor cursor package handling in home-manager configuration - Simplified the cursor package selection by removing the deprecated `cursor-agent` option and retaining only `cursor-cli`. - Updated the activation script to remove the broken `cursor-agent` symlink, ensuring proper resolution to `cursor-cli`. - Adjusted the configuration to reflect these changes in the Nix IDE tools integration. --- modules/wisdom/editors/cursor.nix | 33 ++++++++----------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/modules/wisdom/editors/cursor.nix b/modules/wisdom/editors/cursor.nix index 2eb3d88..5fd2f89 100644 --- a/modules/wisdom/editors/cursor.nix +++ b/modules/wisdom/editors/cursor.nix @@ -12,15 +12,7 @@ cursorPkgs.default else null; - # NixOS-New `home-shared.nix`: `cursor-cli` alongside the AppImage. nixpkgs now names this - # `cursor-agent`; keep both for compatibility across pins. - defaultAgentPkg = - if pkgs ? cursor-agent then - pkgs.cursor-agent - else if pkgs ? cursor-cli then - pkgs.cursor-cli - else - null; + cursorCli = if pkgs ? cursor-cli then pkgs.cursor-cli else null; nixIdeTools = [ pkgs.nixd pkgs.nixfmt ]; cursorWithNixIde = if cursorPkg == null then @@ -47,21 +39,6 @@ default = true; description = "`EDITOR` / `VISUAL` → `cursor --wait`."; }; - agent = { - enable = lib.mkEnableOption '' - Cursor Agent CLI (`cursor-agent` in current nixpkgs; older pins used `cursor-cli`). - '' // { - default = true; - }; - package = lib.mkOption { - type = with lib.types; nullOr package; - default = defaultAgentPkg; - defaultText = "pkgs.cursor-agent or pkgs.cursor-cli or null"; - description = '' - Package providing the `cursor-agent` CLI. Set to `null` to omit the CLI while keeping the GUI app. - ''; - }; - }; nixIde = { enable = lib.mkEnableOption '' Nix IDE extension tooling (`nixd` LSP, `nixfmt` formatter). @@ -82,8 +59,14 @@ else cursorPkg) ] - ++ lib.optionals (cfg.agent.enable && cfg.agent.package != null) [ cfg.agent.package ] + ++ lib.optionals (cursorCli != null) [ cursorCli ] ++ lib.optionals cfg.nixIde.enable nixIdeTools; + + # Cursor's updater drops a generic-linux binary here; remove it so `cursor-agent` resolves to cursor-cli. + home.activation.removeBrokenCursorAgent = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + $DRY_RUN_CMD rm -f "$HOME/.local/bin/cursor-agent" + ''; + home.sessionVariables = lib.mkIf cfg.setAsDefaultEditor { EDITOR = "cursor --wait"; VISUAL = "cursor --wait";