NIX: flake.nix for development environment

This commit is contained in:
Andrew Haynes
2026-03-26 00:57:00 -04:00
parent bf591f0c1b
commit 65241c1d06
7 changed files with 92 additions and 8 deletions
+43
View File
@@ -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"
'';
};
});
};
}