{ inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; outputs = { self, nixpkgs, }: let system = "aarch64-darwin"; pkgs = nixpkgs.legacyPackages.${system}; in { # This builds the 'PROCESSOR' library so other projects can find it packages.${system}.default = pkgs.stdenv.mkDerivation { name = "image_processor"; src = ./.; nativeBuildInputs = [pkgs.cmake]; buildInputs = [pkgs.libjpeg_turbo]; # This ensures the .dylib and .h files are moved to the right place installPhase = '' mkdir -p $out/lib $out/include cp libPROCESSOR.dylib $out/lib/ || cp libPROCESSOR.a $out/lib/ cp *.h $out/include/ ''; }; devShells.${system}.default = pkgs.mkShell { buildInputs = [pkgs.libjpeg_turbo]; shellHook = '' export PKG_CONFIG_PATH="${pkgs.libjpeg_turbo.dev}/lib/pkgconfig:$PKG_CONFIG_PATH" ''; }; }; }