1 # Version string functions.
7 Break a version string into its component parts.
13 splitVersion = builtins.splitVersion;
16 Get the major version string from a string.
22 major = v: builtins.elemAt (splitVersion v) 0;
25 Get the minor version string from a string.
31 minor = v: builtins.elemAt (splitVersion v) 1;
34 Get the patch version string from a string.
40 patch = v: builtins.elemAt (splitVersion v) 2;
43 Get string of the first two parts (major and minor)
50 majorMinor = v: builtins.concatStringsSep "." (lib.take 2 (splitVersion v));
53 Pad a version string with zeros to match the given number of components.
66 numericVersion = lib.head (lib.splitString "-" version);
67 versionSuffix = lib.removePrefix numericVersion version;
69 lib.concatStringsSep "." (lib.take n (lib.splitVersion numericVersion ++ lib.genList (_: "0") n))