61 lines
2.1 KiB
Nix
61 lines
2.1 KiB
Nix
{ inputs, ... }: {
|
|
flake.homeManagerModules.wisdomEditorsCursor =
|
|
{ config, lib, pkgs, ... }:
|
|
let
|
|
root = config.chiasson.home;
|
|
cfg = config.chiasson.home.editors.cursor;
|
|
cursorPkgs = inputs.cursor.packages.${pkgs.stdenv.hostPlatform.system} or { };
|
|
cursorPkg =
|
|
if cursorPkgs ? cursor then
|
|
cursorPkgs.cursor
|
|
else if cursorPkgs ? default then
|
|
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;
|
|
in
|
|
{
|
|
options.chiasson.home.editors.cursor = {
|
|
enable = lib.mkEnableOption "Cursor editor from the `cursor` flake input.";
|
|
setAsDefaultEditor = lib.mkOption {
|
|
type = lib.types.bool;
|
|
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.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf (root.enable && cfg.enable && cursorPkg != null) {
|
|
home.packages =
|
|
[ cursorPkg ]
|
|
++ lib.optionals (cfg.agent.enable && cfg.agent.package != null) [ cfg.agent.package ];
|
|
home.sessionVariables = lib.mkIf cfg.setAsDefaultEditor {
|
|
EDITOR = "cursor --wait";
|
|
VISUAL = "cursor --wait";
|
|
};
|
|
};
|
|
};
|
|
}
|