Skip to content

mcpx: the daemon-mode modules live here, with mcpx (platform-aware: systemd on Linux, launchd on darwin) #4801

Closed

Description

@dezren39

Per Drew (2026-11-03), refining the mcpx consolidation design: the standalone daemon mode is mcpx's own feature, so its Nix modules originate HERE, with mcpx — not in a consumer. Layering:\n- code (this repo): the canonical module source beside pkgs/mcpx — a shared option set (services.mcpx) with platform implementations: systemd on Linux (NixOS + home-manager user units), launchd on darwin.\n- developing-today/opencode: RE-EXPORTS these modules as its own flake outputs (imported from its mcpx-src input), alongside any modules of its own.\n- developing-today/openchamber: passes both through, alongside its own modules.\n- dezren39/nix consumes the whole stack through its single openchamber input (dezren39/darwin-nix#1384) and deletes its modules/mcpx copies.\n\nThis supersedes the original step-2 framing in developing-today-forks/opencode#1502 (modules authored in the fork). Package default in the modules: the mcpx build of whichever flake layer exposes them (ultimately this repo's pkgs/mcpx/package.nix, which also absorbs the platform checkPhase adaptations — #4798).

Activity

  1. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    Implementation plan (from studying the source material, 2026-11-03):\n\nSource: dezren39/nix's modules/mcpx — common.nix (127 lines; the services.mcpx option set: enable, package, settings, servers, environment, environmentFile, configFile), nixos.nix (63; systemd), home-manager.nix (89; systemd user units). There is NO darwin module yet — dezren39/nix runs the daemon on darwin from a hand-rolled launchd agent in its configuration.nix; the canonical darwin module (launchd) is authored here as part of this issue, absorbing that agent's shape.\n\nLayout: pkgs/mcpx/modules/{common,nixos,home-manager,darwin}.nix in this repo — plain module files, importable by path from the source tree (required: the opencode fork consumes this repo as a flake=false source input). This repo's flake also exposes them as nixosModules/homeManagerModules/darwinModules outputs for direct consumers.\n\nPackage defaulting pattern (same as nix does today): the module files themselves leave 'package' without a hard default; each exposing flake wraps them with lib.mkDefault services.mcpx.package = <that flake's own mcpx build>. So: code's outputs default to code's build path, the fork's re-exports default to the fork's packages.mcpx, openchamber passes the fork's outputs through untouched, and dezren39/nix importing via openchamber gets the fork's build — the same build opencode bundles.

  2. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    Darwin source material located (dezren39/nix configuration.nix): the launchd agent is deliberately indirect — the plist runs a FIXED path (/usr/local/libexec/mcpx/mcpx) holding a copy of a wrapper script, because a store path in the plist would change the plist on every mcpx update. The wrapper emits a service-event, stops any old daemon, then execs 'mcpx daemon --config ~/.config/mcpx/config.json'; an activation script refreshes the fixed-path copy before launchd setup. The canonical darwin module must preserve this fixed-path indirection, not naively point launchd at the store path.

  3. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    Scoping complete (2026-11-03). Integration points in this repo: flake.nix composes outputs via lib.merge over lib.make-* functions; mcpx's is make-mcpx-overlay in lib/default.nix (registered in the _self inherit list). The modules land as a sibling contribution (extend make-mcpx-overlay or a make-mcpx-modules) returning nixosModules/homeManagerModules/darwinModules for mcpx.\n\nFiles: pkgs/mcpx/modules/{common,nixos,home-manager}.nix are faithful ports of dezren39/nix's modules/mcpx (option set unchanged); darwin.nix is the new nix-darwin module (launchd.user.agents) carrying configuration.nix's fixed-path pattern — plist runs a fixed-path copy of a wrapper (stop old daemon, exec 'mcpx daemon --config '), refreshed by activation, so the plist stays stable across mcpx updates. The dezren39/nix wrapper's service-events call is a local embellishment and stays behind in that repo.\n\nPackage defaulting: raw module files keep 'package' unset; each exposing layer wraps with mkDefault to its own mcpx build (code: callPackage ../pkgs/mcpx/package.nix via the host pkgs inside the module, the same path make-mcpx-overlay already uses). One open design point the darwin module must respect: nix's home-manager darwin branch points launchd straight at the store path, while the live configuration uses the fixed-path copy — the canonical modules should converge on the fixed-path behavior.

  4. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    Done — the module origin landed in PR #4812 (pkgs/mcpx/modules + make-mcpx-modules outputs), and the full layering is now in place: this repo originates, the fork re-exports (opencode #1505), openchamber passes through (#1431), and dezren39/nix consumes everything through the single openchamber input (nix #1388, closing nix#1384). Companion pieces: #4799 (checkPhase in-package), #4807 (codegen in the build), #4815 (codegen in treefmt).

  5. added
    design/mcpx-consolidationDesign: mcpx-consolidation - all issues of this effort carry it
    epic/mcpxEpic: mcpx - all issues of this effort carry it
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    design/mcpx-consolidationDesign: mcpx-consolidation - all issues of this effort carry itepic/mcpxEpic: mcpx - all issues of this effort carry it

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions