{ description = "Image Processor C API"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; outputs = { self, nixpkgs, }: let supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; in { packages = forAllSystems (system: let pkgs = import nixpkgs {inherit system;}; in { default = pkgs.stdenv.mkDerivation { pname = "image-processor"; version = "0.1.0"; src = ./.; # Since the flake is in the repo, we use local source # nativeBuildInputs are tools needed at build time (like CMake) nativeBuildInputs = [pkgs.cmake pkgs.pkg-config]; # buildInputs are libraries your API depends on (e.g., libpng, opencv) buildInputs = []; # Nix automatically runs: cmakeConfigurePhase, buildPhase, installPhase # You just need to ensure your CMakeLists.txt has 'install()' targets. }; }); devShells = forAllSystems (system: let pkgs = import nixpkgs {inherit system;}; in { default = pkgs.mkShell { inputsFrom = [self.packages.${system}.default]; packages = [pkgs.gdb]; }; }); }; }