- 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>
67 lines
1.6 KiB
Nix
67 lines
1.6 KiB
Nix
{ lib, stdenv, fetchgit, elixir, erlang, rebar3, git, writeShellScript }:
|
|
|
|
let
|
|
systantBase = stdenv.mkDerivation rec {
|
|
pname = "systant-base";
|
|
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 ];
|
|
|
|
MIX_ENV = "prod";
|
|
|
|
configurePhase = ''
|
|
export MIX_HOME=$TMPDIR/mix
|
|
export HEX_HOME=$TMPDIR/hex
|
|
export REBAR_CACHE_DIR=$TMPDIR/rebar3
|
|
|
|
mix local.hex --force
|
|
mix local.rebar --force
|
|
'';
|
|
|
|
buildPhase = ''
|
|
mix deps.get || true
|
|
mix deps.compile || true
|
|
mix compile
|
|
mix release
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
cp -r _build/prod/rel/systant/* $out/
|
|
'';
|
|
};
|
|
|
|
systantWrapper = writeShellScript "systant" ''
|
|
#!/bin/bash
|
|
export RELEASE_COOKIE="systant-cookie-change-in-production"
|
|
exec ${systantBase}/bin/systant "$@"
|
|
'';
|
|
|
|
in stdenv.mkDerivation {
|
|
pname = "systant";
|
|
version = "0.1.0";
|
|
|
|
buildCommand = ''
|
|
mkdir -p $out/bin
|
|
cp ${systantWrapper} $out/bin/systant
|
|
chmod +x $out/bin/systant
|
|
|
|
# Copy the rest of the release
|
|
cp -r ${systantBase}/* $out/
|
|
|
|
echo "Wrapper created - RELEASE_COOKIE will be set by wrapper script"
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Systant - System stats MQTT daemon";
|
|
homepage = "https://git.ryanpandya.com/ryan/systant";
|
|
license = licenses.mit;
|
|
platforms = platforms.linux;
|
|
};
|
|
} |