nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 linkFarm,
4 clr,
5 ollama,
6 python3Packages,
7 rocmPackages,
8 magma-hip,
9 emptyDirectory,
10 stdenv,
11}:
12# This package exists purely to have a bunch of passthru.tests attrs
13let
14 availableRocmDrvs = lib.pipe rocmPackages [
15 (lib.mapAttrsToList (
16 name: value: {
17 inherit name;
18 evaluated = builtins.tryEval value;
19 }
20 ))
21 (builtins.filter (x: x.evaluated.success))
22 (map (x: {
23 inherit (x) name;
24 value = x.evaluated.value;
25 }))
26 (builtins.filter (x: lib.isDerivation x.value && (x.value.meta.available or true)))
27 ];
28in
29stdenv.mkDerivation {
30 name = "rocm-tests";
31 nativeBuildInputs = [
32 clr
33 ];
34 src = emptyDirectory;
35 postInstall = "mkdir -p $out";
36 passthru.tests = {
37 ollama = ollama.override {
38 inherit rocmPackages;
39 acceleration = "rocm";
40 };
41 rocmPackagesDerivations = linkFarm "rocmPackagesDerivations" (
42 map (x: {
43 name = x.name;
44 path = x.value;
45 }) availableRocmDrvs
46 );
47 torch = python3Packages.torch.override {
48 inherit rocmPackages;
49 rocmSupport = true;
50 cudaSupport = false;
51 magma-hip = magma-hip.override {
52 inherit rocmPackages;
53 };
54 };
55 };
56}