diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2016-01-19 09:55:31 +0100 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2016-01-19 09:55:31 +0100 |
commit | 716aac2519a7571e7f5fd984a886d579a4a051c5 (patch) | |
tree | 53cf89cf764d787f4dc8f08474479892b9733177 /lib/strings.nix | |
parent | f8472457a440de3c44f6f604142d678b6ae2a762 (diff) | |
parent | 53b389327e34de319dc0dbda2b6bcab1a69db69d (diff) | |
download | nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.gz nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.bz2 nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.lz nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.xz nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.zst nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.zip |
Merge branch 'staging' into closure-size
Diffstat (limited to 'lib/strings.nix')
-rw-r--r-- | lib/strings.nix | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/strings.nix b/lib/strings.nix index 9a2f3c432ca3..58d3199ac318 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -191,9 +191,13 @@ rec { versionAtLeast = v1: v2: !versionOlder v1 v2; - # Get the version of the specified derivation, as specified in its - # ‘name’ attribute. - getVersion = drv: (builtins.parseDrvName drv.name).version; + # This function takes an argument that's either a derivation or a + # derivation's "name" attribute and extracts the version part from that + # argument. For example: + # + # lib.getVersion "youtube-dl-2016.01.01" ==> "2016.01.01" + # lib.getVersion pkgs.youtube-dl ==> "2016.01.01" + getVersion = x: (builtins.parseDrvName (x.name or x)).version; # Extract name with version from URL. Ask for separator which is |