{
  description = "People Counter with YOLOv8, ByteTrack and Streamlit";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { nixpkgs, flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};

        pythonEnv = pkgs.python313.withPackages (ps: with ps; [
          numpy
          opencv-python
          streamlit
          pyyaml
          pillow
          ultralytics
          torch
          torchvision
          prometheus-client
        ]);
      in {
        devShell = pkgs.mkShell {
          buildInputs = [
            pythonEnv
            pkgs.ffmpeg
            pkgs.mediamtx
          ];

          shellHook = ''
            export PYTHONUNBUFFERED=1
            export MTX_PATHS_ALL_SOURCE=publisher
            echo "People Counter DevShell ready"
          '';
        };
      });
}
