?
This commit is contained in:
@@ -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"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user