diff --git a/home/common/default.nix b/home/common/default.nix index b1eefe781c..9d87d7f1c2 100644 --- a/home/common/default.nix +++ b/home/common/default.nix @@ -916,9 +916,12 @@ in services.mcpx = { # enable comes from the cascade (mkDefault at each layer). # - # This repo's own mcpx build — the package the hand-rolled unit - # ran (pkgs/mcpx) — rather than the fork's re-export default. - package = mcpx; + # package: deliberately unset. There is one mcpx — the + # cascade's (the fork's build, via the module wrapper's + # mkDefault) — and this config takes that one (Drew's ruling, + # 2026-11-03; code#5027). The former pin to this repo's own + # pkgs/mcpx build made two mcpx builds coexist and collided + # with the fork package's bin/mcpx in the home profile. # The daemon's environment, unchanged from the hand-rolled unit # (mcpxEnvironment above). environment = mcpxEnvironment; diff --git a/pkgs/mcpx/modules/home-manager.nix b/pkgs/mcpx/modules/home-manager.nix index 7c922c66a9..709afacabe 100644 --- a/pkgs/mcpx/modules/home-manager.nix +++ b/pkgs/mcpx/modules/home-manager.nix @@ -26,10 +26,25 @@ in { imports = [ ./common.nix ]; + options.services.mcpx.addPackageToProfile = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Whether the module adds `package` to `home.packages`, putting + `bin/mcpx` on the profile PATH. Turn it off when another + package in the profile already provides `bin/mcpx` — the fork + opencode package's `bin/mcpx` is a link to this very build, and + home-manager's buildEnv still counts the package and the link + as two providers of the same path (code#5027). The daemon is + unaffected either way: the service definition runs `package` + directly, never through the profile. + ''; + }; + config = lib.mkIf cfg.enable ( lib.mkMerge [ { - home.packages = [ cfg.package ]; + home.packages = lib.mkIf cfg.addPackageToProfile [ cfg.package ]; # Point every other mcpx client at the same config the # daemon runs, two ways: MCPX_CONFIG in the session