33 lines
787 B
Nix
33 lines
787 B
Nix
{ stdenv
|
|
, lib
|
|
, zig
|
|
, pkg-config
|
|
, system
|
|
}:
|
|
|
|
let
|
|
target = builtins.replaceStrings ["darwin"] ["macos"] system;
|
|
in
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "micrograd.zig";
|
|
version = "0.0.1";
|
|
|
|
src = ./.;
|
|
|
|
nativeBuildInputs = [ zig pkg-config ];
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
zig build --global-cache-dir $(pwd)/.cache -Doptimize=ReleaseSafe -Dtarget=${target} --prefix $out install
|
|
runHook postInstall
|
|
'';
|
|
|
|
outputs = [ "out" ];
|
|
|
|
meta = {
|
|
description = "Karpathy's micrograd, ported to Ziglang";
|
|
homepage = "https://git.oolongtechnologies.io/bogdan/micrograd.zig";
|
|
license = lib.licenses.agpl3Only;
|
|
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
|
};
|
|
})
|