This commit is contained in:
Andrew Haynes
2026-03-26 11:17:41 -04:00
parent 0a1d1c4607
commit e2782a3a44
+10 -33
View File
@@ -1,43 +1,20 @@
{
description = "Image Processor C API";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
outputs = {
self,
nixpkgs,
}: let
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
system = "aarch64-darwin"; # Use "x86_64-darwin" for Intel
pkgs = nixpkgs.legacyPackages.${system};
in {
packages = forAllSystems (system: let
pkgs = import nixpkgs {inherit system;};
in {
default = pkgs.stdenv.mkDerivation {
pname = "image-processor";
version = "0.1.0";
src = ./.; # Since the flake is in the repo, we use local source
devShells.${system}.default = pkgs.mkShell {
buildInputs = [pkgs.libjpeg_turbo];
# nativeBuildInputs are tools needed at build time (like CMake)
nativeBuildInputs = [pkgs.cmake pkgs.pkg-config];
# buildInputs are libraries your API depends on (e.g., libpng, opencv)
buildInputs = [];
# Nix automatically runs: cmakeConfigurePhase, buildPhase, installPhase
# You just need to ensure your CMakeLists.txt has 'install()' targets.
};
});
devShells = forAllSystems (system: let
pkgs = import nixpkgs {inherit system;};
in {
default = pkgs.mkShell {
inputsFrom = [self.packages.${system}.default];
packages = [pkgs.gdb];
};
});
shellHook = ''
export C_INCLUDE_PATH="${pkgs.libjpeg_turbo.dev}/include:$C_INCLUDE_PATH"
export LIBRARY_PATH="${pkgs.libjpeg_turbo}/lib:$LIBRARY_PATH"
'';
};
};
}