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
|
||||
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";
|
||||
|
||||
Reference in New Issue
Block a user