···11+/* Version string functions. */
22+{ lib }:
33+44+let
55+66+ splitVersion = builtins.splitVersion or (lib.splitString ".");
77+88+in
99+1010+rec {
1111+1212+ /* Get the major version string from a string.
1313+1414+ Example:
1515+ major "1.2.3"
1616+ => "1"
1717+ */
1818+ major = v: builtins.elemAt (splitVersion v) 0;
1919+2020+ /* Get the minor version string from a string.
2121+2222+ Example:
2323+ minor "1.2.3"
2424+ => "2"
2525+ */
2626+ minor = v: builtins.elemAt (splitVersion v) 1;
2727+2828+ /* Get the patch version string from a string.
2929+3030+ Example:
3131+ patch "1.2.3"
3232+ => "3"
3333+ */
3434+ patch = v: builtins.elemAt (splitVersion v) 2;
3535+3636+ /* Get string of the first two parts (major and minor)
3737+ of a version string.
3838+3939+ Example:
4040+ majorMinor "1.2.3"
4141+ => "1.2"
4242+ */
4343+ majorMinor = v:
4444+ builtins.concatStringsSep "."
4545+ (lib.take 2 (splitVersion v));
4646+4747+}