Add MIX_ENV=test mix deps.compile after NIF build. The _build/test
tree is ephemeral (cleared when nix devShell derivation changes), which
causes 'Mox is not available' errors. This ensures test deps like Mox
are ready before the user ever runs mix test.
- Change postgresql_16 → postgresql_17 in shell.nix (17.10 available)
- Both postgis and timescaledb confirmed available for PG17
- Remove PG17-only transaction_timeout SET from structure.sql
(dump was already PG17, now compatible with running server)
- Auto-reinit triggers on version file mismatch
- Register :towerops_nif compiler in mix.exs so mix compile/test builds the C NIF
- Add 'make -C c_src' to nix devShell shellHook so NIF is pre-built
- Extract init_mib_resolution/0 from Application.start/2 (reduces CC)
- Wrap NIF calls in try/rescue ErlangError for graceful fallback
- Wrap test_helper.exs NIF calls in try/rescue ErlangError
- Add .nix-postgres-version to .gitignore
Run start-services in a background subshell with stdin closed so
nix develop doesn't wait on daemonized PostgreSQL/Redis child
processes before starting the interactive shell.
The version check was after the early-exit guard, so if services were
already running it never triggered. Now it runs first, stopping and
reinitializing the cluster before checking the flag.
- Write pg derivation path to .nix-postgres-version after init
- On start, compare current pg path with stored version
- If changed (extensions added/removed/version bumped), destroy and
reinitialize the cluster automatically
- Also reinit legacy clusters that have no version file
- Exclude .nix-postgres-version from release builds
When direnv evaluates the shellHook (DIRENV_DIR is set), skip mix local,
service startup, pre-commit install, and the welcome banner. These
operations block direnv and trigger nix profile cleanup hangs on macOS.
Only run them in interactive nix develop sessions.
- Remove 'trap ... EXIT' that kills services when entering the dev shell
- Fix DATABASE_URL: $USER → $USER (no backslash) so bash expands it
instead of passing the literal string 'USER' as the PG role name
Set up mix_gleam archive, gleam_stdlib, and gleeunit deps. Add Gleam
compiler to all Dockerfiles, CI workflows, nix shell, and .tool-versions.
Rewrite Numeric, QueryHelpers, and URLValidator from Elixir to Gleam with
full ExUnit test coverage. Update all callers to use the Gleam modules
directly via :towerops@module syntax. Remove duplicate sanitize_like/1
private functions in snmp.ex and trace.ex.
Reviewed-on: graham/towerops-web#98
- Fix CLOAK_KEY placeholder in nix shell (invalid base64)
- Fix error HTML test assertion to match actual template
- Fix Gaiia sync: read 'subnet' field instead of 'block' for IP blocks
- Fix Gaiia sync: extract nested status name from subscription objects
- Fix security headers tests for environment detection
- Fix mobile auth tests to use raw_token
- Fix LiveView test assertions to match actual template content
- Fix SNMP config test expectations for test environment
- Refactor: resolve all Credo complexity/nesting issues
- Extract helper functions in NetBox sync, VISP sync, Sonar sync
- Flatten nested conditionals in settings, integrations, alerts
- Use with/validate_present pattern for connection testing
- Use postgresql_16.withPackages to include timescaledb extension
- Add shared_preload_libraries to PostgreSQL config
- Enable TimescaleDB for both dev and test databases
- Disable TimescaleDB telemetry in dev
Nix build fixes:
- Override beamPackages.elixir to use 1.19.5 instead of default 1.18.4
- Add explicit buildPhase to compile dependencies before application
- Remove postInstall phase (Mix automatically includes priv/ in release)
- Set HEX_OFFLINE=false to allow dependency fetching in Nix sandbox
Docker image build now succeeds (~507 MB compressed).
Also remove .claude/settings.local.json from git tracking (keep local).
File remains in working directory but is now properly ignored.
Add git and cacert to nativeBuildInputs and set SSL certificate
environment variables. This fixes the SSL certificate verification
error when fetching heroicons from GitHub.
Override configurePhase to explicitly run 'mix deps.get' before
compilation. This ensures hex dependencies (like ecto) are available
when vendored path dependencies (oban_met) are compiled.
The postUnpack step was deleting deps directories which may have
been removing vendored dependencies. cleanSourceWith already handles
source filtering, so postUnpack is redundant and potentially harmful.
Remove buggy conditional that was always true. Now the filter
correctly excludes only build artifacts while including all
source files including vendor directory.
Replace sourceFilesBySuffices with cleanSourceWith to ensure
vendor directory and all dependencies are properly included.
This fixes the oban_met compilation error.
Find the erts include path dynamically instead of relying on
erlang.version which may not match the actual erts version.
This fixes 'erl_nif.h' file not found error.
Instead of hardcoding the version in the path, find the release
directory dynamically. This fixes the 'undefined variable version'
error during Docker image build.
- Check if PostgreSQL/Redis already running before starting
- Install Hex and Rebar3 non-interactively on shell entry
- Only run migrations if deps directory exists
- Better error messages with log file locations
This fixes issues when:
- Port 5432 is already in use (existing PostgreSQL)
- Port 6379 is already in use (existing Redis)
- Mix prompts for Hex installation interactively
Use stdenv.isLinux instead of lib.isLinux to properly check if
inotify-tools should be included. This fixes the undefined variable
error when evaluating the flake on macOS.
- Make inotify-tools Linux-only (not available on Darwin)
- Replace nixfmt-rfc-style with nixfmt (deprecated warning)
- Add flake.lock for reproducible builds
Changes:
- nix/shell.nix: Conditionally include inotify-tools only on Linux
- flake.nix: Use pkgs.nixfmt instead of pkgs.nixfmt-rfc-style
- flake.lock: Lock dependencies for reproducibility