A lightweight system monitoring agent that: - Collects metrics via configurable shell commands - Publishes to MQTT with Home Assistant auto-discovery - Supports entity types: sensor, binary_sensor, light, switch, button - Responds to commands over MQTT for controllable entities Architecture: - src/config.ts: TOML config loading and validation - src/mqtt.ts: MQTT client with HA discovery - src/entities.ts: Entity state polling and command handling - index.ts: CLI entry point (run, check, once commands) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
59 lines
1.2 KiB
Nix
59 lines
1.2 KiB
Nix
{
|
|
description = "Systant";
|
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
flake-utils,
|
|
...
|
|
}:
|
|
flake-utils.lib.eachDefaultSystem (
|
|
system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
config.allowUnfree = true;
|
|
};
|
|
systant-cli = pkgs.writeShellScriptBin "systant" ''
|
|
cd "$PROJECT_ROOT" && ./dist/systant "$@"
|
|
'';
|
|
in
|
|
with pkgs;
|
|
{
|
|
devShell = pkgs.mkShell {
|
|
buildInputs = [
|
|
bashInteractive
|
|
glibcLocales
|
|
git
|
|
bun
|
|
inotify-tools
|
|
claude-code
|
|
systant-cli
|
|
];
|
|
|
|
shellHook = ''
|
|
export PROJECT_ROOT=$PWD
|
|
'';
|
|
};
|
|
packages = {
|
|
systant-server = pkgs.callPackage ./nix/package.nix {
|
|
src = ./server;
|
|
};
|
|
systant-cli = pkgs.systant-cli;
|
|
default = systant-cli;
|
|
};
|
|
|
|
apps = {
|
|
default = {
|
|
type = "app";
|
|
program = "${self.packages.${system}.default}/bin/systant";
|
|
};
|
|
};
|
|
}
|
|
);
|
|
}
|