objectifier/flake.nix

63 lines
1.9 KiB
Nix

{
inputs = {
darknet = {
url = "github:pjreddie/darknet";
flake = false;
};
nixpkgs.url = "nixpkgs/nixos-22.11";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, darknet, utils, ... }:
utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}";
pythonYolo = pkgs.python3.withPackages
(pyPkgs: with pyPkgs; [ fastapi opencv4 python-multipart ]);
in {
packages = rec {
objectifier = pkgs.callPackage ./objectifier.nix { };
yolo-cli = pkgs.callPackage ./yolo-cli.nix { inherit yolov3-data; };
yolov3-data = pkgs.callPackage ./yolo-data.nix { inherit darknet; };
};
devShells = {
default = pkgs.mkShell {
buildInputs = let
pythonYolo = pkgs.python3.withPackages (pyPkgs:
with pyPkgs; [
fastapi
gunicorn
opencv4
python-multipart
uvicorn
]);
in [ pythonYolo ];
};
yolo-cli = pkgs.mkShell {
buildInputs = [ self.packages."${system}".yolo-cli ];
};
};
}) // {
nixosModules = rec {
default = objectifier;
objectifier = {
imports = [ ./objectifier-module.nix ];
config.nixpkgs.overlays = [ self.overlays.objectifier ];
};
};
overlays = rec {
default = final: prev: {
inherit (self.packages."${prev.system}") objectifier yolo-cli;
};
objectifier = final: prev: {
inherit (self.packages."${prev.system}") objectifier yolov3-data;
};
yolo-cli = final: prev: {
inherit (self.packages."${prev.system}") yolo-cli;
};
};
};
}