1 /* Version string functions. */
6 /* Break a version string into its component parts.
12 splitVersion = builtins.splitVersion or (lib.splitString ".");
14 /* Get the major version string from a string.
20 major = v: builtins.elemAt (splitVersion v) 0;
22 /* Get the minor version string from a string.
28 minor = v: builtins.elemAt (splitVersion v) 1;
30 /* Get the patch version string from a string.
36 patch = v: builtins.elemAt (splitVersion v) 2;
38 /* Get string of the first two parts (major and minor)
46 builtins.concatStringsSep "."
47 (lib.take 2 (splitVersion v));
49 /* Pad a version string with zeros to match the given number of components.
60 numericVersion = lib.head (lib.splitString "-" version);
61 versionSuffix = lib.removePrefix numericVersion version;
62 in lib.concatStringsSep "." (lib.take n (lib.splitVersion numericVersion ++ lib.genList (_: "0") n)) + versionSuffix;