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.
This commit is contained in:
@@ -12,15 +12,7 @@
|
|||||||
cursorPkgs.default
|
cursorPkgs.default
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
# NixOS-New `home-shared.nix`: `cursor-cli` alongside the AppImage. nixpkgs now names this
|
cursorCli = if pkgs ? cursor-cli then pkgs.cursor-cli else null;
|
||||||
# `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;
|
|
||||||
nixIdeTools = [ pkgs.nixd pkgs.nixfmt ];
|
nixIdeTools = [ pkgs.nixd pkgs.nixfmt ];
|
||||||
cursorWithNixIde =
|
cursorWithNixIde =
|
||||||
if cursorPkg == null then
|
if cursorPkg == null then
|
||||||
@@ -47,21 +39,6 @@
|
|||||||
default = true;
|
default = true;
|
||||||
description = "`EDITOR` / `VISUAL` → `cursor --wait`.";
|
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 = {
|
nixIde = {
|
||||||
enable = lib.mkEnableOption ''
|
enable = lib.mkEnableOption ''
|
||||||
Nix IDE extension tooling (`nixd` LSP, `nixfmt` formatter).
|
Nix IDE extension tooling (`nixd` LSP, `nixfmt` formatter).
|
||||||
@@ -82,8 +59,14 @@
|
|||||||
else
|
else
|
||||||
cursorPkg)
|
cursorPkg)
|
||||||
]
|
]
|
||||||
++ lib.optionals (cfg.agent.enable && cfg.agent.package != null) [ cfg.agent.package ]
|
++ lib.optionals (cursorCli != null) [ cursorCli ]
|
||||||
++ lib.optionals cfg.nixIde.enable nixIdeTools;
|
++ 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 {
|
home.sessionVariables = lib.mkIf cfg.setAsDefaultEditor {
|
||||||
EDITOR = "cursor --wait";
|
EDITOR = "cursor --wait";
|
||||||
VISUAL = "cursor --wait";
|
VISUAL = "cursor --wait";
|
||||||
|
|||||||
Reference in New Issue
Block a user