systant/nix/package.nix
ryan b8e7c48ecf Implement network throughput monitoring instead of cumulative bytes
- Add iftop as runtime dependency in package.nix and flake.nix
- Modify SystemMetrics to calculate network throughput (bytes/second)
- Track previous network stats in MQTT client state for throughput calculation
- Update Home Assistant discovery to show RX/TX throughput sensors
- Replace cumulative byte counters with real-time throughput metrics
- Add proper throughput calculation with time-based differentials

This provides much more useful real-time network monitoring compared
to ever-increasing cumulative byte counts.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-08 21:02:29 -07:00

46 lines
1.1 KiB
Nix

{
lib,
beamPackages,
src,
iftop,
}:
beamPackages.mixRelease rec {
pname = "systant";
version = "0.1.0";
inherit src;
# Runtime dependencies
buildInputs = [ iftop ];
# Disable distributed Erlang to avoid COOKIE requirement
postInstall = ''
# Create wrapper script that sets proper environment including COOKIE
mv $out/bin/systant $out/bin/.systant-wrapped
cat > $out/bin/systant << EOF
#!/bin/sh
export RELEASE_DISTRIBUTION=none
export RELEASE_NODE=nonode@nohost
export RELEASE_COOKIE=dummy_cookie_for_single_node
exec "$out/bin/.systant-wrapped" "\$@"
EOF
chmod +x $out/bin/systant
'';
# Mix dependencies will be automatically fetched and cached by Nix
mixFodDeps = beamPackages.fetchMixDeps {
pname = "systant-mix-deps";
inherit src version;
sha256 = "sha256-99aIYuSEO7V0Scgh6c4+FIStQpM2ccUvY1NwBArvhi8=";
};
meta = with lib; {
description = "Systant - System stats MQTT daemon for monitoring system metrics";
homepage = "https://git.ryanpandya.com/ryan/systant";
license = licenses.mit;
maintainers = [ ];
platforms = platforms.linux;
};
}