From babb721f1527c08960944879b2a33a85d3af7d8e Mon Sep 17 00:00:00 2001 From: Andrew Haynes Date: Thu, 26 Mar 2026 11:25:50 -0400 Subject: [PATCH] ? --- flake.nix | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index e33f986..cc15e22 100644 --- a/flake.nix +++ b/flake.nix @@ -8,16 +8,24 @@ system = "aarch64-darwin"; pkgs = nixpkgs.legacyPackages.${system}; in { - devShells.${system}.default = pkgs.mkShell { - # pkg-config is needed for CMake to "see" the library - nativeBuildInputs = [pkgs.pkg-config]; + # 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" - 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." ''; }; };