Skip to content

Commit 7fa5ba0

Browse files
committed
nix: add cuda to the flake
1 parent 3aefaab commit 7fa5ba0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

flake.nix

+24
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,30 @@
6969
"-DLLAMA_CLBLAST=ON"
7070
];
7171
};
72+
packages.cuda = pkgs.stdenv.mkDerivation {
73+
inherit name src meta postPatch nativeBuildInputs postInstall;
74+
buildInputs = with pkgs; buildInputs ++ [ cudaPackages.cudatoolkit ];
75+
76+
# HACK(Green-Sky): nix currently has issues with cmake findcudatoolkit, so we force gnu make
77+
# see https://github.com/NixOS/nixpkgs/issues/224291
78+
dontUseCmakeConfigure = true;
79+
dontUseNinjaBuild = true;
80+
81+
buildFlags = [ "LLAMA_CUBLAS=1" ];
82+
installPhase = ''
83+
mkdir -p $out/bin
84+
85+
# TODO(Green-Sky): add install target to Makefile, or wait for cmake support
86+
mv main $out/bin/
87+
mv server $out/bin/
88+
mv speculative $out/bin/
89+
mv perplexity $out/bin/
90+
mv embedding $out/bin/
91+
mv quantize $out/bin/
92+
mv llama-bench $out/bin/
93+
mv train-text-from-scratch $out/bin/
94+
'';
95+
};
7296
packages.rocm = pkgs.stdenv.mkDerivation {
7397
inherit name src meta postPatch nativeBuildInputs postInstall;
7498
buildInputs = with pkgs; buildInputs ++ [ hip hipblas rocblas ];

0 commit comments

Comments
 (0)