Something went wrong. Try again.
What happens if I push all of nixpkgs
Something went wrong. Try again.
1.2 kB · 79 lines
Nix
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980{ _cuda, lib }:let cudaLib = _cuda.lib;in{ /** Extracts the major, minor, and patch version from a string.
# Type
``` majorMinorPatch :: (version :: String) -> String ```
# Inputs
`version`
: The version string
# Examples
:::{.example} ## `_cuda.lib.majorMinorPatch` usage examples
```nix majorMinorPatch "11.0.3.4" => "11.0.3" ``` ::: */ majorMinorPatch = cudaLib.trimComponents 3;
/** Get a version string with no more than than the specified number of components.
# Type
``` trimComponents :: (numComponents :: Integer) -> (version :: String) -> String ```
# Inputs
`numComponents` : A positive integer corresponding to the maximum number of components to keep
`version` : A version string
# Examples
:::{.example} ## `_cuda.lib.trimComponents` usage examples
```nix trimComponents 1 "1.2.3.4" => "1" ```
```nix trimComponents 3 "1.2.3.4" => "1.2.3" ```
```nix trimComponents 9 "1.2.3.4" => "1.2.3.4" ``` ::: */ trimComponents = n: v: lib.pipe v [ lib.splitVersion (lib.take n) (lib.concatStringsSep ".") ];}