diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..77644f2ab --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1777425547, + "narHash": "sha256-d57AbflkNfZNoFaZDzssEq1RfPoM9dLtOGI2O+N/68Q=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ebc08544afa77957cc348ba72dc490ec73b87f68", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..caf51a45f --- /dev/null +++ b/flake.nix @@ -0,0 +1,57 @@ +{ + description = "oMLX - LLM inference server optimized for Apple Silicon"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + + outputs = { self, nixpkgs }: + let + system = "aarch64-darwin"; + pkgs = import nixpkgs { inherit system; }; + python = pkgs.python312; + version = pkgs.lib.removeSuffix "\"" + (pkgs.lib.removePrefix "__version__ = \"" + (pkgs.lib.trim (builtins.readFile ./omlx/_version.py))); + in + { + packages.${system}.default = python.pkgs.buildPythonApplication { + pname = "omlx"; + inherit version; + pyproject = true; + src = self; + build-system = with python.pkgs; [ + setuptools + wheel + ]; + + dependencies = with python.pkgs; [ + fastapi + itsdangerous + jsonschema + mlx + mlx-lm + pillow + requests + uvicorn + ]; + dontCheckRuntimeDeps = true; + + meta = { + description = "LLM inference server optimized for Apple Silicon"; + homepage = "https://github.com/jundot/omlx"; + license = pkgs.lib.licenses.asl20; + maintainers = with pkgs.lib.maintainers; [ dzmitry-lahoda ]; + platforms = [ system ]; + mainProgram = "omlx"; + }; + }; + + devShells.${system}.default = pkgs.mkShell { + packages = [ + python + pkgs.uv + ]; + }; + }; +}