{
  description = "Cross compile libcamera app for Raspberry Pi Zero";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  };

  outputs = { self, nixpkgs }:
    let
      system = "x86_64-linux";

      pkgs = import nixpkgs {
        inherit system;

        crossSystem = {
          config = "armv6l-unknown-linux-gnueabihf";
        };
      };
    in
    {
      devShells.${system}.default =
        pkgs.mkShell {
          packages = with pkgs; [
            stdenv.cc

            pkg-config

            libcamera

            libGL
            libglvnd

            mesa

            # useful tools
            gdb
          ];

          shellHook = ''
            echo "ARM cross shell for Raspberry Pi Zero"
            echo

            export CC=arm-linux-gnueabihf-gcc
            export CXX=arm-linux-gnueabihf-g++

            export PKG_CONFIG_ALLOW_CROSS=1

            echo "Compiler:"
            $CXX --version
          '';
        };
    };
}
