about summary refs log tree commit diff
path: root/pkgs/development/cuda-modules/modules/generic/types/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/cuda-modules/modules/generic/types/default.nix')
-rw-r--r--pkgs/development/cuda-modules/modules/generic/types/default.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/pkgs/development/cuda-modules/modules/generic/types/default.nix b/pkgs/development/cuda-modules/modules/generic/types/default.nix
new file mode 100644
index 0000000000000..61d13b3cc8d2b
--- /dev/null
+++ b/pkgs/development/cuda-modules/modules/generic/types/default.nix
@@ -0,0 +1,39 @@
+{lib, ...}:
+let
+  inherit (lib) options types;
+in
+{
+  options.generic.types = options.mkOption {
+    type = types.attrsOf types.optionType;
+    default = {};
+    description = "A set of generic types.";
+  };
+  config.generic.types = {
+    cudaArch = types.strMatching "^sm_[[:digit:]]+[a-z]?$" // {
+      name = "cudaArch";
+      description = "A CUDA architecture name.";
+    };
+    # https://github.com/ConnorBaker/cuda-redist-find-features/blob/c841980e146f8664bbcd0ba1399e486b7910617b/cuda_redist_find_features/types/_lib_so_name.py
+    libSoName = types.strMatching ".*\\.so(\\.[[:digit:]]+)*$" // {
+      name = "libSoName";
+      description = "The name of a shared object file.";
+    };
+
+    majorMinorVersion = types.strMatching "^([[:digit:]]+)\\.([[:digit:]]+)$" // {
+      name = "majorMinorVersion";
+      description = "A version number with a major and minor component.";
+    };
+
+    majorMinorPatchVersion = types.strMatching "^([[:digit:]]+)\\.([[:digit:]]+)\\.([[:digit:]]+)$" // {
+      name = "majorMinorPatchVersion";
+      description = "A version number with a major, minor, and patch component.";
+    };
+
+    majorMinorPatchBuildVersion =
+      types.strMatching "^([[:digit:]]+)\\.([[:digit:]]+)\\.([[:digit:]]+)\\.([[:digit:]]+)$"
+      // {
+        name = "majorMinorPatchBuildVersion";
+        description = "A version number with a major, minor, patch, and build component.";
+      };
+  };
+}