39 lines
1.0 KiB
Nix
39 lines
1.0 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
|
|
cp libPROCESSOR.dylib $out/lib/ 2>/dev/null || cp libPROCESSOR.a $out/lib/
|
|
cp *.h $out/include/
|
|
'';
|
|
};
|
|
|
|
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];
|
|
};
|
|
};
|
|
}
|