- nixosModules.default is now the multi-instance module (old single-
instance module removed; nixosModules.multi kept as a transition alias).
- clanService rewritten: one inventory instance hosts N corpora via
`roles.server…settings.corpora` (attrsOf), mapped to
services.clan-rag.instances. Shared globals (user/model/embedModel/
ragHost/openToMesh) are role settings. Per-machine MeiliSearch key +
one bearer key per gated corpus as clan vars. Dropped LibreChat, OIDC/
authelia, nginx, mongodb, and all their vars/exports — the interface is
the MCP (+ TUI), delivered via per-project .mcp.json.
- client role now just installs the clan-rag-{query,tui,mcp} binaries.
VM test unchanged (hand-rolls its own stack; binary behaviour compatible).
flake check green. Real validation is an eyduhverse rebuild.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
105 lines
3.7 KiB
Nix
105 lines
3.7 KiB
Nix
{
|
|
description = "Local RAG for clan.lol — NPU-accelerated via FastFlowLM + MeiliSearch";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
nix-amd-ai = {
|
|
url = "github:noamsto/nix-amd-ai";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
clan-core = {
|
|
url = "git+https://git.clan.lol/eyduh/clan-core";
|
|
flake = false; # source tree only — we want docs/, not the flake outputs
|
|
};
|
|
|
|
crane.url = "github:ipetkov/crane";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, nix-amd-ai, clan-core, crane, ... }:
|
|
let
|
|
systems = [ "x86_64-linux" ];
|
|
|
|
forAll = f: nixpkgs.lib.genAttrs systems (s:
|
|
f s (import nixpkgs { system = s; config.allowUnfree = true; })
|
|
);
|
|
|
|
flmPort = 52625;
|
|
meiliPort = 7700;
|
|
model = "gemma4-it:e4b";
|
|
embedModel = "embeddinggemma-300m";
|
|
docs = "${clan-core}";
|
|
clanCoreRev = clan-core.rev or "main";
|
|
|
|
mkPkg = pkgs: import ./nix/clan-rag.nix { inherit pkgs crane; };
|
|
in
|
|
{
|
|
# ── Clan service module (server + client roles) ──────────────────────
|
|
clanModules.clan-rag = import ./clanServices { inherit nix-amd-ai clan-core crane clanCoreRev; };
|
|
|
|
# ── Standalone NixOS module ──────────────────────────────────────────
|
|
nixosModules.default = import ./nixosModules { inherit nix-amd-ai clan-core crane clanCoreRev; };
|
|
|
|
# Transition alias: `multi` is now the default module. Kept so an existing
|
|
# `nixosModules.multi` import (e.g. the arcus hardware test) keeps working
|
|
# while you switch over to the clanService. Remove once nothing imports it.
|
|
nixosModules.multi = import ./nixosModules { inherit nix-amd-ai clan-core crane clanCoreRev; };
|
|
|
|
packages = forAll (s: pkgs:
|
|
let pkg = mkPkg pkgs;
|
|
in {
|
|
clan-rag = pkg;
|
|
default = pkg;
|
|
}
|
|
);
|
|
|
|
apps = forAll (s: pkgs:
|
|
let
|
|
pkg = mkPkg pkgs;
|
|
runner = import ./nix/runner.nix {
|
|
inherit pkgs nix-amd-ai pkg flmPort meiliPort model embedModel docs clanCoreRev;
|
|
system = s;
|
|
};
|
|
wrap = binName: withAutoIndex: {
|
|
type = "app";
|
|
program = "${runner { inherit binName withAutoIndex; }}/bin/${binName}";
|
|
};
|
|
in
|
|
{
|
|
# These start MeiliSearch + FLM, auto-index on first run, then clean up on exit
|
|
clan-rag-query = wrap "clan-rag-query" true;
|
|
clan-rag-tui = wrap "clan-rag-tui" true;
|
|
clan-rag-mcp = wrap "clan-rag-mcp" true;
|
|
# Index bundled clan docs; pass args: -- --docs <path> all
|
|
clan-rag-index = wrap "clan-rag-index" false;
|
|
# Long-running service — manages its own lifecycle via NixOS module
|
|
clan-rag-api = { type = "app"; program = "${pkg}/bin/clan-rag-api"; };
|
|
default = wrap "clan-rag-query" true;
|
|
}
|
|
);
|
|
|
|
devShells = forAll (s: pkgs: {
|
|
default = import ./nix/devshell.nix {
|
|
inherit pkgs nix-amd-ai flmPort meiliPort model;
|
|
system = s;
|
|
};
|
|
});
|
|
|
|
# ── Checks: clippy, fmt, VM test ─────────────────────────────────────
|
|
checks = forAll (s: pkgs:
|
|
let
|
|
clanChecks = import ./nix/checks.nix { inherit pkgs crane; };
|
|
pkg = mkPkg pkgs;
|
|
in
|
|
{
|
|
inherit (clanChecks) clippy fmt;
|
|
vm-test = import ./tests/vm.nix {
|
|
inherit pkgs nix-amd-ai clan-core;
|
|
clanRag = pkg;
|
|
};
|
|
}
|
|
);
|
|
};
|
|
}
|