This commit is contained in:
Andrew Haynes
2026-03-26 11:25:50 -04:00
parent 9595f0ec1b
commit babb721f15
+14 -6
View File
@@ -8,16 +8,24 @@
system = "aarch64-darwin"; system = "aarch64-darwin";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in { in {
devShells.${system}.default = pkgs.mkShell { # This builds the 'PROCESSOR' library so other projects can find it
# pkg-config is needed for CMake to "see" the library packages.${system}.default = pkgs.stdenv.mkDerivation {
nativeBuildInputs = [pkgs.pkg-config]; name = "image_processor";
src = ./.;
nativeBuildInputs = [pkgs.cmake];
buildInputs = [pkgs.libjpeg_turbo]; 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 = '' shellHook = ''
export PKG_CONFIG_PATH="${pkgs.libjpeg_turbo.dev}/lib/pkgconfig:$PKG_CONFIG_PATH" export PKG_CONFIG_PATH="${pkgs.libjpeg_turbo.dev}/lib/pkgconfig:$PKG_CONFIG_PATH"
export C_INCLUDE_PATH="${pkgs.libjpeg_turbo.dev}/include:$C_INCLUDE_PATH"
export LIBRARY_PATH="${pkgs.libjpeg_turbo}/lib:$LIBRARY_PATH"
echo "✅ Environment ready: libturbojpeg and pkg-config loaded."
''; '';
}; };
}; };