47 lines
1.4 KiB
Nix
47 lines
1.4 KiB
Nix
{
|
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
|
|
|
outputs = {
|
|
self,
|
|
nixpkgs,
|
|
}: let
|
|
system = "aarch64-darwin";
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
in {
|
|
packages.${system}.default = pkgs.stdenv.mkDerivation {
|
|
name = "image_processor";
|
|
src = ./.;
|
|
|
|
# Add pkg-config here so CMake can find it during the build
|
|
nativeBuildInputs = [
|
|
pkgs.cmake
|
|
pkgs.pkg-config
|
|
];
|
|
|
|
buildInputs = [pkgs.libjpeg_turbo];
|
|
|
|
# Nix's default CMake phase will run, but we need to ensure
|
|
# the library actually gets installed to the nix store output
|
|
installPhase = ''
|
|
mkdir -p $out/lib $out/include
|
|
|
|
# Copy the library (looks like your build made a static lib 'libPROCESSOR.a')
|
|
cp libPROCESSOR.a $out/lib/
|
|
|
|
# Copy headers safely.
|
|
# If your headers are in a subfolder, change './*.h' to './src/*.h' etc.
|
|
# The '|| true' ensures the build doesn't crash if no headers are found.
|
|
cp *.h $out/include/ || cp src/*.h $out/include/ || true
|
|
|
|
echo "✅ Installed libPROCESSOR.a and headers to $out"
|
|
'';
|
|
};
|
|
|
|
devShells.${system}.default = pkgs.mkShell {
|
|
# This makes sure the shell also has the tools for manual debugging
|
|
nativeBuildInputs = [pkgs.pkg-config pkgs.cmake];
|
|
buildInputs = [pkgs.libjpeg_turbo];
|
|
};
|
|
};
|
|
}
|