NIX: flake.nix for development environment
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
{
|
||||
description = "Image Processor API";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
}: let
|
||||
supportedSystems = ["aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
pkgsFor = system: import nixpkgs {inherit system;};
|
||||
in {
|
||||
# This allows other flakes to "consume" this library
|
||||
packages = forAllSystems (system: let
|
||||
pkgs = pkgsFor system;
|
||||
in {
|
||||
default = pkgs.stdenv.mkDerivation {
|
||||
pname = "image_processor";
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
nativeBuildInputs = [pkgs.cmake pkgs.pkg-config];
|
||||
buildInputs = [pkgs.libjpeg_turbo];
|
||||
};
|
||||
});
|
||||
|
||||
# This provides the dev environment for the API itself
|
||||
devShells = forAllSystems (system: let
|
||||
pkgs = pkgsFor system;
|
||||
in {
|
||||
default = pkgs.mkShell {
|
||||
nativeBuildInputs = [pkgs.cmake pkgs.pkg-config];
|
||||
buildInputs = [pkgs.libjpeg_turbo];
|
||||
shellHook = ''
|
||||
export CPATH="${pkgs.libjpeg_turbo.dev}/include:$CPATH"
|
||||
echo "⚙️ Image Processor API Dev Shell"
|
||||
'';
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user