1{ callPackage, stdenv }:
2let
3 # this GPU families are supported "by-default" upstream (see https://github.com/Syllo/nvtop/blob/3a69c2d060298cd6f92cb09db944eded98be1c23/CMakeLists.txt#L81)
4 # coincidentally, these families are also easy to build in nixpkgs at the moment
5 defaultGPUFamilies = [
6 "amd"
7 "apple"
8 "intel"
9 "msm"
10 "nvidia"
11 "panfrost"
12 "panthor"
13 "v3d"
14 ];
15 # these GPU families are partially supported upstream, they are also tricky to build in nixpkgs
16 # volunteers with specific hardware needed to build and test these package variants
17 additionalGPUFamilies = [
18 "ascend"
19 "tpu"
20 ];
21 defaultSupport = builtins.listToAttrs (
22 # apple can only build on darwin, and it can't build everything else, and vice versa
23 builtins.map (gpu: {
24 name = gpu;
25 value =
26 (gpu == "apple" && stdenv.buildPlatform.isDarwin && stdenv.hostPlatform == stdenv.buildPlatform)
27 || (gpu != "apple" && stdenv.buildPlatform.isLinux);
28 }) defaultGPUFamilies
29 );
30in
31{
32 full = callPackage ./build-nvtop.nix defaultSupport; # this package supports all default GPU families
33}
34# additional packages with only one specific GPU family support
35// builtins.listToAttrs (
36 builtins.map (gpu: {
37 name = gpu;
38 value = (callPackage ./build-nvtop.nix { "${gpu}" = true; });
39 }) defaultGPUFamilies
40)