lib.versions: version string functions

lib.versions.splitVersion

Break a version string into its component parts.

Type

splitVersion :: String -> [String]

Examples

Example

splitVersion usage example

splitVersion "1.2.3"
=> ["1" "2" "3"]

Located at lib/versions.nix:28 in <nixpkgs>.

lib.versions.major

Get the major version string from a string.

Inputs

v

1. Function argument

Type

major :: String -> String

Examples

Example

major usage example

major "1.2.3"
=> "1"

Located at lib/versions.nix:56 in <nixpkgs>.

lib.versions.minor

Get the minor version string from a string.

Inputs

v

1. Function argument

Type

minor :: String -> String

Examples

Example

minor usage example

minor "1.2.3"
=> "2"

Located at lib/versions.nix:84 in <nixpkgs>.

lib.versions.patch

Get the patch version string from a string.

Inputs

v

1. Function argument

Type

patch :: String -> String

Examples

Example

patch usage example

patch "1.2.3"
=> "3"

Located at lib/versions.nix:112 in <nixpkgs>.

lib.versions.majorMinor

Get string of the first two parts (major and minor) of a version string.

Inputs

v

1. Function argument

Type

majorMinor :: String -> String

Examples

Example

majorMinor usage example

majorMinor "1.2.3"
=> "1.2"

Located at lib/versions.nix:141 in <nixpkgs>.

lib.versions.pad

Pad a version string with zeros to match the given number of components.

Inputs

n

1. Function argument

version

2. Function argument

Type

pad :: Int -> String -> String

Examples

Example

pad usage example

pad 3 "1.2"
=> "1.2.0"
pad 3 "1.3-rc1"
=> "1.3.0-rc1"
pad 3 "1.2.3.4"
=> "1.2.3"

Located at lib/versions.nix:177 in <nixpkgs>.