b6becd5e01
CI / check (push) Has been cancelled
- packages/open-code-review/opencode-plugin.nix: builds the plugin TS file
plus runtime node_modules from the plugin's package-lock.json into
share/open-code-review/opencode (exposed as passthru.opencode-plugin,
same source rev as the CLI so versions stay locked)
- modules/open-code-review-hm.nix: homeManagerModules.default with
programs.open-code-review.{enable,opencode.enable} — symlinks the plugin
and node_modules into ~/.config/opencode/plugins/ and installs the CLI
- flake.nix: expose homeManagerModules.default
Note: upstream declares the plugin SDKs as devDependencies, so the
lockfile install must not use --omit=dev.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
51 lines
1.7 KiB
Nix
51 lines
1.7 KiB
Nix
# Home Manager module: installs the OpenCode plugin for OpenCodeReview.
|
|
#
|
|
# Creates symlinks under ~/.config/opencode/plugins/ for the plugin file and
|
|
# its runtime node_modules, and puts the matching `ocr` CLI on PATH.
|
|
#
|
|
# Note: the node_modules symlink is shared by everything in the plugins
|
|
# directory. Plugins installed by other means that need conflicting npm
|
|
# dependencies cannot coexist with this one.
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.programs.open-code-review;
|
|
in
|
|
{
|
|
options.programs.open-code-review = {
|
|
enable = lib.mkEnableOption "OpenCodeReview AI code review CLI and its OpenCode plugin";
|
|
|
|
package = lib.mkOption {
|
|
type = lib.types.package;
|
|
default = pkgs.open-code-review;
|
|
defaultText = lib.literalExpression "pkgs.open-code-review";
|
|
description = "The open-code-review package to use.";
|
|
};
|
|
|
|
opencode = {
|
|
enable = lib.mkEnableOption "symlink the bundled OpenCode plugin into ~/.config/opencode";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable (lib.mkMerge [
|
|
{
|
|
home.packages = [ cfg.package ];
|
|
}
|
|
(lib.mkIf cfg.opencode.enable {
|
|
# The plugin resolves its imports Node-style: node_modules next to the
|
|
# plugin file, or in any parent directory (via the file's realpath).
|
|
# Linking both the file and node_modules covers either resolution.
|
|
xdg.configFile."opencode/plugins/open-code-review.ts".source =
|
|
"${cfg.package.passthru.opencode-plugin}/share/open-code-review/opencode/open-code-review.ts";
|
|
|
|
xdg.configFile."opencode/plugins/node_modules".source =
|
|
"${cfg.package.passthru.opencode-plugin}/share/open-code-review/opencode/node_modules";
|
|
})
|
|
]);
|
|
}
|