{ lib , stdenv , fetchgit , elixir , erlang , rebar3 , git , cacert , glibcLocales }: stdenv.mkDerivation rec { pname = "systant"; version = "0.1.0"; src = fetchgit { url = "https://git.ryanpandya.com/ryan/systant.git"; rev = "92fc90e3b470dd2d11ba3a84745e33195e8e9db3"; sha256 = lib.fakeSha256; # Replace with actual hash after first build attempt }; nativeBuildInputs = [ elixir erlang rebar3 git cacert glibcLocales ]; buildPhase = '' runHook preBuild # Set up environment for Mix/Hex export MIX_ENV=prod export MIX_HOME=$TMPDIR/mix export HEX_HOME=$TMPDIR/hex export REBAR_CACHE_DIR=$TMPDIR/rebar3 # SSL and locale configuration export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt export LOCALE_ARCHIVE=${glibcLocales}/lib/locale/locale-archive export LC_ALL=en_US.UTF-8 export ELIXIR_ERL_OPTIONS="+fnu" # Install hex and rebar locally mix local.hex --force mix local.rebar --force # Get dependencies and build release mix deps.get --only=prod mix release runHook postBuild ''; installPhase = '' runHook preInstall mkdir -p $out cp -r _build/prod/rel/systant/* $out/ runHook postInstall ''; meta = with lib; { description = "Systant - System stats MQTT daemon for monitoring system metrics"; homepage = "https://git.ryanpandya.com/ryan/systant"; license = licenses.mit; # Update if different maintainers = [ ]; # Add your maintainer info if desired platforms = platforms.linux; }; }