1# Modules
2
3Modules as they are used in `modules` exist primarily to check the shape and
4content of CUDA redistributable and feature manifests. They are ultimately meant
5to reduce the repetitive nature of repackaging CUDA redistributables.
6
7Building most redistributables follows a pattern of a manifest indicating which
8packages are available at a location, their versions, and their hashes. To avoid
9creating builders for each and every derivation, modules serve as a way for us
10to use a single `genericManifestBuilder` to build all redistributables.
11
12## `generic`
13
14The modules in `generic` are reusable components meant to check the shape and
15content of NVIDIA's CUDA redistributable manifests, our feature manifests (which
16are derived from NVIDIA's manifests), or hand-crafted Nix expressions describing
17available packages. They are used by the `genericManifestBuilder` to build CUDA
18redistributables.
19
20Generally, each package which relies on manifests or Nix release expressions
21will create an alias to the relevant generic module. For example, the [module
22for CUDNN](./cudnn/default.nix) aliases the generic module for release
23expressions, while the [module for CUDA redistributables](./cuda/default.nix)
24aliases the generic module for manifests.
25
26Alternatively, additional fields or values may need to be configured to account
27for the particulars of a package. For example, while the release expressions for
28[CUDNN](../cudnn/releases.nix) and [TensorRT](../tensorrt/releases.nix) are very
29close, they differ slightly in the fields they have. The [module for
30CUDNN](./cudnn/default.nix) is able to use the generic module for
31release expressions, while the [module for
32TensorRT](./tensorrt/default.nix) must add additional fields to the
33generic module.
34
35### `manifests`
36
37The modules in `generic/manifests` define the structure of NVIDIA's CUDA
38redistributable manifests and our feature manifests.
39
40NVIDIA's redistributable manifests are retrieved from their web server, while
41the feature manifests are produced by
42[`cuda-redist-find-features`](https://github.com/connorbaker/cuda-redist-find-features).
43
44### `releases`
45
46The modules in `generic/releases` define the structure of our hand-crafted Nix
47expressions containing information necessary to download and repackage CUDA
48redistributables. These expressions are created when NVIDIA-provided manifests
49are unavailable or otherwise unusable. For example, though CUDNN has manifests,
50a bug in NVIDIA's CI/CD causes manifests for different versions of CUDA to use
51the same name, which leads to the manifests overwriting each other.
52
53### `types`
54
55The modules in `generic/types` define reusable types used in both
56`generic/manifests` and `generic/releases`.