Skip to content

Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)

Merge PR #242 development shell into existing flake

Cinna Davis34e5f109430b
diff --cc docs/SETUP.md
index f231272,f231272..acf4851
--- a/docs/SETUP.md
+++ b/docs/SETUP.md
@@@ -9,6 -9,6 +9,10 @@@
- GitHub CLI (`gh`) with access to this repository when
downloading the checkpoint assets. Local/offline runs do not require GitHub access.
++Nix users can enter the development shell first with `nix develop`. It supplies
++Python 3.12, ffmpeg, GitHub CLI, and native build libraries; install the Python
++dependencies into a virtual environment using the commands below.
++
Create an isolated environment from the repository root:
```bash
diff --cc flake.nix
index 6c8f727,d700099..21bf346
--- a/flake.nix
+++ b/flake.nix
@@@ -1,24 -1,72 +1,75 @@@
{
- description = "DOPPLERGEIST development environment (Python 3.12 + ffmpeg + geospatial/audio system libs)";
+ description = "DOPPLERGEIST - A tool to geolocate audio recordings using aircraft Doppler shifts and historical flight tracks.";
inputs = {
- nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.zst";
};
- outputs = { self, nixpkgs }:
- let
- systems = [
- "x86_64-linux"
- "aarch64-linux"
- "x86_64-darwin"
- "aarch64-darwin"
- ];
- forEachSystem = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
- in
- {
- devShells = forEachSystem (pkgs:
- let
- python = pkgs.python312;
- in
- {
- default = pkgs.mkShell {
- name = "dopplergeist-dev";
+ outputs = inputs: {
+ packages = builtins.mapAttrs (system: pkgs: {
+ dopplergeist = pkgs.callPackage ./package.nix { };
- packages = [
- python
- pkgs.ffmpeg # provides ffmpeg + ffprobe (libmp3lame encoder needed by MP3 smoke tests)
- pkgs.gh # GitHub CLI, needed for checkpoint-asset downloads
- pkgs.git
- pkgs.pkg-config
- pkgs.stdenv.cc
- # Native libraries behind the pip dependencies in pyproject.toml
- # (rasterio -> GDAL/PROJ/GEOS/HDF5/netCDF, soundfile -> libsndfile,
- # scipy/numpy -> OpenBLAS, matplotlib -> freetype).
- pkgs.gdal
- pkgs.proj
- pkgs.geos
- pkgs.hdf5
- pkgs.netcdf
- pkgs.libsndfile
- pkgs.fftw
- pkgs.openblas
- pkgs.freetype
- pkgs.zlib
- ];
+ default = inputs.self.packages.${system}.dopplergeist;
+ }) inputs.nixpkgs.legacyPackages;
- shellHook = ''
- # Pinned manylinux wheels (e.g. rasterio) need libz/libstdc++
- # from outside the venv; Nix does not put them on the loader
- # path by default.
- export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [ pkgs.zlib pkgs.expat pkgs.stdenv.cc.cc ]}:''${LD_LIBRARY_PATH:-}"
- # Match the CI/threading defaults in .github/workflows.
- export MPLBACKEND="''${MPLBACKEND:-Agg}"
- export PYTHONUNBUFFERED="''${PYTHONUNBUFFERED:-1}"
- export OPENBLAS_NUM_THREADS="''${OPENBLAS_NUM_THREADS:-1}"
- export OMP_NUM_THREADS="''${OMP_NUM_THREADS:-1}"
+ apps = builtins.mapAttrs (system: _: {
+ default = {
+ type = "app";
+ program = "${inputs.self.packages.${system}.default}/bin/dopplergeist";
+ };
+ }) inputs.nixpkgs.legacyPackages;
- # Let pip builds find the Nix-provided native libraries.
- export GDAL_DATA="${pkgs.gdal}/share/gdal"
- export PROJ_DATA="${pkgs.proj}/share/proj"
- export PKG_CONFIG_PATH="${pkgs.libsndfile}/lib/pkgconfig:${pkgs.hdf5}/lib/pkgconfig:''${PKG_CONFIG_PATH:-}"
++ devShells = builtins.mapAttrs (_: pkgs:
++ let python = pkgs.python312;
++ in {
++ default = pkgs.mkShell {
++ name = "dopplergeist-dev";
+
- echo "DOPPLERGEIST dev shell: $(python --version 2>&1), $(ffmpeg -version 2>/dev/null | head -1)"
- echo "Create an isolated env per docs/SETUP.md:"
- echo " python -m venv .venv && .venv/bin/python -m pip install -e . && .venv/bin/dopplergeist --version"
- '';
- };
- });
- };
++ packages = [
++ python
++ pkgs.ffmpeg # provides ffmpeg + ffprobe (libmp3lame encoder needed by MP3 smoke tests)
++ pkgs.gh # GitHub CLI, needed for checkpoint-asset downloads
++ pkgs.git
++ pkgs.pkg-config
++ pkgs.stdenv.cc
++ # Native libraries behind the pip dependencies in pyproject.toml
++ # (rasterio -> GDAL/PROJ/GEOS/HDF5/netCDF, soundfile -> libsndfile,
++ # scipy/numpy -> OpenBLAS, matplotlib -> freetype).
++ pkgs.gdal
++ pkgs.proj
++ pkgs.geos
++ pkgs.hdf5
++ pkgs.netcdf
++ pkgs.libsndfile
++ pkgs.fftw
++ pkgs.openblas
++ pkgs.freetype
++ pkgs.zlib
++ ];
++
++ shellHook = ''
++ # Pinned manylinux wheels (e.g. rasterio) need libz/libstdc++
++ # from outside the venv; Nix does not put them on the loader
++ # path by default.
++ export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [ pkgs.zlib pkgs.expat pkgs.stdenv.cc.cc ]}:''${LD_LIBRARY_PATH:-}"
++ # Match the CI/threading defaults in .github/workflows.
++ export MPLBACKEND="''${MPLBACKEND:-Agg}"
++ export PYTHONUNBUFFERED="''${PYTHONUNBUFFERED:-1}"
++ export OPENBLAS_NUM_THREADS="''${OPENBLAS_NUM_THREADS:-1}"
++ export OMP_NUM_THREADS="''${OMP_NUM_THREADS:-1}"
++
++ # Let pip builds find the Nix-provided native libraries.
++ export GDAL_DATA="${pkgs.gdal}/share/gdal"
++ export PROJ_DATA="${pkgs.proj}/share/proj"
++ export PKG_CONFIG_PATH="${pkgs.libsndfile}/lib/pkgconfig:${pkgs.hdf5}/lib/pkgconfig:''${PKG_CONFIG_PATH:-}"
++
++ echo "DOPPLERGEIST dev shell: $(python --version 2>&1), $(ffmpeg -version 2>/dev/null | head -1)"
++ echo "Create an isolated env per docs/SETUP.md:"
++ echo " python -m venv .venv && .venv/bin/python -m pip install -e . && .venv/bin/dopplergeist --version"
++ '';
++ };
++ }) inputs.nixpkgs.legacyPackages;
++
+ formatter = builtins.mapAttrs (_: pkgs: pkgs.nixfmt) inputs.nixpkgs.legacyPackages;
+ };
}