mcp dev environment
This commit is contained in:
53
modules/dev/mcp.nix
Normal file
53
modules/dev/mcp.nix
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
python = pkgs.python3.withPackages (
|
||||||
|
ps:
|
||||||
|
builtins.attrValues {
|
||||||
|
inherit (ps)
|
||||||
|
click
|
||||||
|
pytest
|
||||||
|
black
|
||||||
|
ruff
|
||||||
|
;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
packages = builtins.attrValues {
|
||||||
|
inherit python;
|
||||||
|
inherit (pkgs) codex; # codex-cli from openai
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
my.dev.mcp = {
|
||||||
|
enable = lib.mkEnableOption "Install MCP tooling globally";
|
||||||
|
users = lib.mkOption {
|
||||||
|
type = inputs.self.lib.usersOptionType lib;
|
||||||
|
default = config.my.toggleUsers.dev;
|
||||||
|
description = "Users to install MCP packages for";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
devShells.mcp = lib.mkOption {
|
||||||
|
type = lib.types.package;
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
inherit packages;
|
||||||
|
name = "mcp-dev-shell";
|
||||||
|
shellHook = ''
|
||||||
|
export CODEX_HOME=$PWD/.codex
|
||||||
|
export PYTHONPATH=$PWD/scripts/mcp-server/src
|
||||||
|
alias mcp-run="python -m mcp_server.server"
|
||||||
|
echo "MCP shell ready: codex + python + PYTHONPATH set"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
description = "MCP + Codex shell for this repo";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = lib.mkIf config.my.dev.mcp.enable {
|
||||||
|
users.users = inputs.self.lib.mkUserAttrs lib config.my.dev.mcp.users { inherit packages; };
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user