first commit

This commit is contained in:
didier committed 2026-05-31 12:35:40 -04:00
commit 2ffae91aa7
10 files changed
+891

No files matched your search

+125
View File
@@ -0,0 +1,125 @@
{
description = "St-Pierre - MCP Knowledge Server";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
(flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
st-pierre = pkgs.buildGoModule {
pname = "st-pierre";
version = "0.1.0";
src = ./.;
vendorHash = "sha256-pSBt5y3Mu8kYX9Vaq3jNU+k8748DLo/RGHV5PqiYelM=";
};
in
{
packages.default = st-pierre;
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ go gopls gotools ];
};
}
)) // {
nixosModules.st-pierre = { config, pkgs, lib, ... }:
let
cfg = config.services.st-pierre;
st-pierre-pkg = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
in
{
options.services.st-pierre = {
enable = lib.mkEnableOption "St-Pierre knowledge MCP server";
port = lib.mkOption {
type = lib.types.port;
default = 8080;
description = "HTTP port to listen on.";
};
qdrantUrl = lib.mkOption {
type = lib.types.str;
default = "localhost";
description = "Qdrant server hostname.";
};
qdrantPort = lib.mkOption {
type = lib.types.port;
default = 6334;
description = "Qdrant gRPC port.";
};
qdrantApiKeyFile = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
description = "Path to a file containing the Qdrant API key.";
};
qdrantTls = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable TLS for Qdrant connection.";
};
openaiApiKeyFile = lib.mkOption {
type = lib.types.path;
description = "Path to a file containing the API key (OpenAI or DeepSeek).";
};
embeddingBaseUrl = lib.mkOption {
type = lib.types.str;
default = "https://api.openai.com/v1";
description = "Base URL for the embeddings API.";
};
embeddingModel = lib.mkOption {
type = lib.types.str;
default = "text-embedding-3-small";
description = "Embedding model name.";
};
tokenFile = lib.mkOption {
type = lib.types.path;
description = "Path to a file containing the MCP Bearer token.";
};
};
config = lib.mkIf cfg.enable {
users.groups.st-pierre = { };
users.users.st-pierre = {
createHome = true;
isSystemUser = true;
home = "/var/lib/st-pierre";
group = "st-pierre";
};
systemd.services.st-pierre = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
User = "st-pierre";
Group = "st-pierre";
Restart = "always";
WorkingDirectory = "/var/lib/st-pierre";
ExecStart = "${st-pierre-pkg}/bin/st-pierre";
EnvironmentFile = [ cfg.openaiApiKeyFile cfg.tokenFile ]
++ lib.optional (cfg.qdrantApiKeyFile != null) cfg.qdrantApiKeyFile;
};
environment = {
PORT = builtins.toString cfg.port;
QDRANT_URL = cfg.qdrantUrl;
QDRANT_PORT = builtins.toString cfg.qdrantPort;
QDRANT_TLS = if cfg.qdrantTls then "true" else "false";
EMBEDDING_BASE_URL = cfg.embeddingBaseUrl;
EMBEDDING_MODEL = cfg.embeddingModel;
};
};
};
};
};
}