This commit is contained in:
Andrew Haynes
2026-03-26 11:17:41 -04:00
parent 0a1d1c4607
commit e2782a3a44
+9 -32
View File
@@ -1,43 +1,20 @@
{ {
description = "Image Processor C API"; inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
}: let }: let
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; system = "aarch64-darwin"; # Use "x86_64-darwin" for Intel
forAllSystems = nixpkgs.lib.genAttrs supportedSystems; pkgs = nixpkgs.legacyPackages.${system};
in { in {
packages = forAllSystems (system: let devShells.${system}.default = pkgs.mkShell {
pkgs = import nixpkgs {inherit system;}; buildInputs = [pkgs.libjpeg_turbo];
in {
default = pkgs.stdenv.mkDerivation {
pname = "image-processor";
version = "0.1.0";
src = ./.; # Since the flake is in the repo, we use local source
# nativeBuildInputs are tools needed at build time (like CMake) shellHook = ''
nativeBuildInputs = [pkgs.cmake pkgs.pkg-config]; export C_INCLUDE_PATH="${pkgs.libjpeg_turbo.dev}/include:$C_INCLUDE_PATH"
export LIBRARY_PATH="${pkgs.libjpeg_turbo}/lib:$LIBRARY_PATH"
# 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];
};
});
}; };
} }