You've already forked tribes-plugin-supertest
forked from tribes/tribes-plugin-template
982243e64a
Refresh the plugin Mix dependency FOD hash for the current host source. Align the probe telemetry event and VictoriaMetrics query with the metric actually exported by the host telemetry reporter.
157 lines
5.0 KiB
Nix
157 lines
5.0 KiB
Nix
{
|
|
description = "Tribes Supertest plugin";
|
|
|
|
inputs = {
|
|
tribes.url = "git+https://git.teralink.net/tribes/tribes.git";
|
|
};
|
|
|
|
outputs = {
|
|
self,
|
|
tribes,
|
|
}: 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.1";
|
|
|
|
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 ./.;
|
|
supertestManifest = builtins.fromJSON (builtins.readFile ./manifest.json);
|
|
|
|
buildTribesPlugin = pkgs.callPackage "${tribes}/nix/tribes-plugin-package.nix" {};
|
|
|
|
supertestPlugin = buildTribesPlugin {
|
|
pname = "tribes-plugin-supertest";
|
|
inherit version src;
|
|
hostRelease = tribes.packages.${system}.tribesRelease;
|
|
hostSource = tribes;
|
|
mixFodDepsHash = "sha256-O8+48XnD2eFRW/w6sHvo3qS5hunddEGVGpvjMduClBM=";
|
|
nativeBuildInputs = [pkgs.gcc pkgs.gnumake];
|
|
meta.description = "Migration and sync fixture plugin for Tribes";
|
|
};
|
|
|
|
supertestPluginE2E = buildTribesPlugin {
|
|
pname = "tribes-plugin-supertest";
|
|
inherit version src;
|
|
hostRelease = tribes.packages.${system}.tribesReleaseE2E;
|
|
hostSource = tribes;
|
|
mixFodDepsHash = "sha256-O8+48XnD2eFRW/w6sHvo3qS5hunddEGVGpvjMduClBM=";
|
|
nativeBuildInputs = [pkgs.gcc pkgs.gnumake];
|
|
meta.description = "Migration and sync fixture plugin for Tribes";
|
|
};
|
|
|
|
supertestExternalPlugin = package: {
|
|
name = "tribe-one-supertest";
|
|
inherit package;
|
|
manifest = supertestManifest;
|
|
};
|
|
|
|
supertestWithTribesE2E =
|
|
(import "${tribes}/default.nix" {
|
|
inherit pkgs lib;
|
|
hostRelease = tribes.packages.${system}.tribesReleaseE2E;
|
|
projectRoot = tribes;
|
|
pluginConfigs = [
|
|
{
|
|
name = "tribe-one-tribes-ui";
|
|
path = "./plugins/tribes_ui";
|
|
}
|
|
(supertestExternalPlugin supertestPluginE2E)
|
|
];
|
|
})
|
|
.release;
|
|
in
|
|
{
|
|
default = supertestPlugin;
|
|
inherit supertestPlugin supertestPluginE2E supertestWithTribesE2E;
|
|
}
|
|
// lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
|
supertestDockerE2E = pkgs.dockerTools.buildLayeredImage {
|
|
name = "tribes-supertest-e2e";
|
|
tag = "latest";
|
|
|
|
contents = [
|
|
supertestWithTribesE2E
|
|
pkgs.bash
|
|
pkgs.cacert
|
|
pkgs.coreutils
|
|
pkgs.curl
|
|
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 = ["${supertestWithTribesE2E}/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=${supertestWithTribesE2E}/plugins"
|
|
"PATH=${lib.makeBinPath [pkgs.bash pkgs.coreutils pkgs.curl]}"
|
|
];
|
|
};
|
|
};
|
|
}
|
|
);
|
|
};
|
|
}
|