diff --git a/.claude/settings.local.json b/.claude/settings.local.json deleted file mode 100644 index 7ae41774..00000000 --- a/.claude/settings.local.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "permissions": { - "allow": [ - "Bash(mix test:*)", - "Bash(mix format:*)", - "Bash(mix credo:*)", - "Bash(git add:*)", - "Bash(git commit:*)" - ] - } -} diff --git a/.gitignore b/.gitignore index 2c523f1e..15ccf14d 100644 --- a/.gitignore +++ b/.gitignore @@ -94,3 +94,4 @@ profiles.json .beads/ .logs/ .direnv/ + diff --git a/flake.nix b/flake.nix index 3b2da473..02cef5ce 100644 --- a/flake.nix +++ b/flake.nix @@ -55,7 +55,12 @@ # Ensure beam packages use our pinned versions # This affects mixRelease and all BEAM-related builds - beamPackages = prev.beam.packages.erlang_28; + # Override the default elixir within beamPackages to use 1.19 + beamPackages = prev.beam.packages.erlang_28.extend ( + self: super: { + elixir = super.elixir_1_19; + } + ); }) ]; }; diff --git a/nix/build.nix b/nix/build.nix index 911d7d25..6d213ea4 100644 --- a/nix/build.nix +++ b/nix/build.nix @@ -56,6 +56,9 @@ beamPackages.mixRelease { export SSL_CERT_FILE="${cacert}/etc/ssl/certs/ca-bundle.crt" export GIT_SSL_CAINFO="${cacert}/etc/ssl/certs/ca-bundle.crt" + # Disable Hex offline mode to allow fetching dependencies + export HEX_OFFLINE=false + # Get all deps (including hex deps that vendored packages need) mix deps.get --only prod @@ -79,29 +82,29 @@ beamPackages.mixRelease { EOF ''; + # Custom build phase to compile deps first, then app + buildPhase = '' + runHook preBuild + + # Compile dependencies (including custom compilers like phoenix_live_view) + mix deps.compile + + # Compile application + mix compile + + runHook postBuild + ''; + # Build assets after Mix compilation postBuild = '' # Build production assets (Tailwind + esbuild) mix assets.deploy ''; - # Install MIB files to the release - postInstall = '' - # Find the release directory (mixRelease creates lib/-) - RELEASE_DIR=$(find $out/lib -maxdepth 1 -type d -name "towerops-*" | head -1) - - if [ -n "$RELEASE_DIR" ]; then - # Copy MIB files directory - if [ -d "$src/priv/mibs" ]; then - mkdir -p $RELEASE_DIR/priv/mibs - cp -r $src/priv/mibs/* $RELEASE_DIR/priv/mibs/ - fi - - # Ensure NIF is in the release - mkdir -p $RELEASE_DIR/priv - cp ${towerops-nif}/lib/towerops_nif.so $RELEASE_DIR/priv/ - fi - ''; + # MIB files and NIF are automatically included by Mix release + # Mix includes everything in priv/ directory when building the release + # No postInstall needed - NIF was copied to priv/ in preBuild + # and MIB files are already in priv/mibs/ from source meta = { description = "Towerops - Phoenix LiveView SNMP monitoring platform";