Files
self 4658b76241
CI / Test (push) Failing after 22s
feat: prefix Kobold plugin slug
Rename Kobold and Trust plugin identity references to tribe-one-prefixed slugs across runtime API, e2e fixtures, and docs.
2026-06-17 22:33:25 +02:00

179 lines
5.6 KiB
Nix

{
description = "Tribes Kobold plugin";
inputs = {
tribes.url = "git+https://git.teralink.net/tribes/tribes.git";
trust = {
url = "git+https://git.teralink.net/tribes/tribes-plugin-trust.git";
flake = false;
};
};
outputs = {
self,
tribes,
trust,
}: let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = tribes.inputs.nixpkgs.lib.genAttrs systems;
in {
formatter = forAllSystems (system: (import tribes.inputs.nixpkgs {inherit system;}).alejandra);
packages = forAllSystems (
system: let
pkgs = import tribes.inputs.nixpkgs {inherit system;};
lib = pkgs.lib;
version = "0.1.0";
cleanSource = src:
lib.cleanSourceWith {
inherit src;
filter = path: type: let
pathStr = toString path;
rootStr = toString src;
relPath =
if pathStr == rootStr
then "."
else lib.removePrefix "${rootStr}/" pathStr;
excluded = [
".devenv"
".direnv"
".git"
"_build"
"deps"
"node_modules"
"result"
];
base = baseNameOf pathStr;
in
lib.cleanSourceFilter path type
&& !(lib.any (prefix: relPath == prefix || lib.hasPrefix "${prefix}/" relPath) excluded)
&& relPath != ".env"
&& !(lib.hasPrefix ".devenv" base)
&& !(lib.hasSuffix ".log" base)
&& !(lib.hasSuffix ".tsbuildinfo" base);
};
src = cleanSource ./.;
trustSrc = cleanSource trust;
koboldManifest = builtins.fromJSON (builtins.readFile ./manifest.json);
trustManifest = builtins.fromJSON (builtins.readFile "${trust}/manifest.json");
buildTribesPlugin = pkgs.callPackage "${tribes}/nix/tribes-plugin-package.nix" {};
koboldPlugin = buildTribesPlugin {
pname = "tribes-plugin-kobold";
inherit version src;
hostRelease = tribes.packages.${system}.tribesRelease;
hostSource = tribes;
mixFodDepsHash = "sha256-O8+48XnD2eFRW/w6sHvo3qS5hunddEGVGpvjMduClBM=";
meta.description = "Distributed dataset plugin for Tribes";
};
koboldPluginE2E = buildTribesPlugin {
pname = "tribes-plugin-kobold";
inherit version src;
hostRelease = tribes.packages.${system}.tribesReleaseE2E;
hostSource = tribes;
mixFodDepsHash = "sha256-O8+48XnD2eFRW/w6sHvo3qS5hunddEGVGpvjMduClBM=";
meta.description = "Distributed dataset plugin for Tribes";
};
trustPluginE2E = buildTribesPlugin {
pname = "tribes-plugin-trust";
inherit version;
src = trustSrc;
hostRelease = tribes.packages.${system}.tribesReleaseE2E;
hostSource = tribes;
mixFodDepsHash = "sha256-O8+48XnD2eFRW/w6sHvo3qS5hunddEGVGpvjMduClBM=";
meta.description = "Tribe trust plugin for Tribes";
};
koboldExternalPlugin = package: {
name = "tribe-one-kobold";
inherit package;
manifest = koboldManifest;
extraPackages = [];
};
trustExternalPlugin = package: {
name = "tribe-one-trust";
inherit package;
manifest = trustManifest;
extraPackages = [];
};
koboldWithTribesE2E =
(import "${tribes}/default.nix" {
inherit pkgs lib;
hostRelease = tribes.packages.${system}.tribesReleaseE2E;
projectRoot = tribes;
pluginConfigs = [
{
name = "tribe-one-tribes-ui";
path = "./plugins/tribes_ui";
}
(trustExternalPlugin trustPluginE2E)
(koboldExternalPlugin koboldPluginE2E)
];
})
.release;
in
{
default = koboldPlugin;
inherit koboldPlugin koboldPluginE2E trustPluginE2E koboldWithTribesE2E;
}
// lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
koboldDockerE2E = pkgs.dockerTools.buildLayeredImage {
name = "tribes-kobold-e2e";
tag = "latest";
contents = [
koboldWithTribesE2E
pkgs.bash
pkgs.cacert
pkgs.coreutils
pkgs.fakeNss
];
extraCommands = ''
mkdir -p tmp etc/ssl/certs
ln -s ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt etc/ssl/certs/ca-certificates.crt
ln -s ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt etc/ssl/cert.pem
chmod 1777 tmp
'';
config = {
Entrypoint = ["${koboldWithTribesE2E}/bin/tribes"];
Cmd = ["start"];
ExposedPorts = {
"4000/tcp" = {};
"4413/tcp" = {};
};
WorkingDir = "/";
User = "65534:65534";
Env = [
"HOME=/tmp"
"LANG=C.UTF-8"
"LC_ALL=C.UTF-8"
"MIX_ENV=prod"
"PHX_SERVER=true"
"PORT=4000"
"RELEASE_DISTRIBUTION=none"
"RELEASE_MODE=interactive"
"SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt"
"TRIBES_PLUGIN_DIR=${koboldWithTribesE2E}/plugins"
"PATH=${lib.makeBinPath [pkgs.bash pkgs.coreutils]}"
];
};
};
}
);
};
}