query
On this page

getVersion

lib.strings.getVersion

Docs pulled from | This Revision | 11 minutes ago


This function takes an argument x that's either a derivation or a derivation's "name" attribute and extracts the version part from that argument.

Inputs

x
1. Function argument

Type

getVersion :: String | Derivation -> String

Examples

lib.strings.getVersion usage example

getVersion "youtube-dl-2016.01.01"
=> "2016.01.01"
getVersion pkgs.youtube-dl
=> "2016.01.01"

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

getVersion = let
    parse = drv: (parseDrvName drv).version;
  in x:
    if isString x
    then parse x
    else x.version or (parse x.name);