systant/systant-manual.nix
ryan 54f8d23945 Remove COOKIE complexity - disable distributed Erlang
- Remove explicit cookie configuration from release
- Set RELEASE_DISTRIBUTION=none and RELEASE_NODE=nonode@nohost
- Simplify Nix derivation by removing postInstall hooks
- Single standalone daemon doesn't need Erlang node clustering

Fixes persistent COOKIE file issues in Nix builds.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-02 18:15:11 -07:00

62 lines
1.7 KiB
Nix

{ lib, stdenv, fetchgit, elixir, erlang, rebar3, git }:
stdenv.mkDerivation rec {
pname = "systant";
version = "0.1.0";
src = fetchgit {
url = "https://git.ryanpandya.com/ryan/systant.git";
rev = "f8173a1afb03623039ff504c587d7322a9876f3d";
sha256 = "sha256-1cRfSoH+JdO4a7q4hRZSkoDMk2wMCYRIyCIN56FSUgg=";
};
nativeBuildInputs = [ elixir erlang rebar3 git ];
# Disable network access - we'll handle deps manually
MIX_ENV = "prod";
configurePhase = ''
export MIX_HOME=$TMPDIR/mix
export HEX_HOME=$TMPDIR/hex
export REBAR_CACHE_DIR=$TMPDIR/rebar3
# Install hex and rebar locally
mix local.hex --force
mix local.rebar --force
'';
buildPhase = ''
# This will fail but that's OK - we're using it to get deps info
mix deps.get || true
# Manual dependency installation (you'd need to add each dep here)
# For now, let's try without deps to see if it builds
mix deps.compile --skip-deps || true
mix compile
mix release
echo "=== Build phase debug ==="
find _build/prod/rel/ -name "*COOKIE*" || echo "No COOKIE in build"
'';
installPhase = ''
mkdir -p $out
cp -r _build/prod/rel/systant/* $out/
# Force create COOKIE file
mkdir -p $out/releases
echo "systant-cookie-change-in-production" > $out/releases/COOKIE
echo "=== Install phase debug ==="
echo "COOKIE created manually in installPhase" > /tmp/manual-nix-debug
ls -la $out/releases/
cat $out/releases/COOKIE
'';
meta = with lib; {
description = "Systant - System stats MQTT daemon";
homepage = "https://git.ryanpandya.com/ryan/systant";
license = licenses.mit;
platforms = platforms.linux;
};
}