Files
NixOS/modules/dev/mcp.nix
2026-01-31 17:39:52 -06:00

54 lines
1.2 KiB
Nix

{
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; };
};
}