summary refs log tree commit diff
path: root/lib/strings.nix
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2016-08-13 17:16:37 +0200
committerDomen Kožar <domen@dev.si>2016-08-13 17:17:36 +0200
commit661415d4ebe11b8c9b9c973f6909237c4cb6e92d (patch)
tree61a4daaafa6f1c1b7aa53212c6ea8b86a8ba4f41 /lib/strings.nix
parenta7f8787dbd2b98f1c913aba7e0f53f38aa975df8 (diff)
downloadnixpkgs-661415d4ebe11b8c9b9c973f6909237c4cb6e92d.tar
nixpkgs-661415d4ebe11b8c9b9c973f6909237c4cb6e92d.tar.gz
nixpkgs-661415d4ebe11b8c9b9c973f6909237c4cb6e92d.tar.bz2
nixpkgs-661415d4ebe11b8c9b9c973f6909237c4cb6e92d.tar.lz
nixpkgs-661415d4ebe11b8c9b9c973f6909237c4cb6e92d.tar.xz
nixpkgs-661415d4ebe11b8c9b9c973f6909237c4cb6e92d.tar.zst
nixpkgs-661415d4ebe11b8c9b9c973f6909237c4cb6e92d.zip
getVersion: first try drv.version before parsing drv.name
Diffstat (limited to 'lib/strings.nix')
-rw-r--r--lib/strings.nix7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/strings.nix b/lib/strings.nix
index 89169411a02..86af4d43834 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -372,7 +372,12 @@ rec {
        getVersion pkgs.youtube-dl
        => "2016.01.01"
   */
-  getVersion = x: (builtins.parseDrvName (x.name or x)).version;
+  getVersion = x:
+   let
+     parse = drv: (builtins.parseDrvName drv).version;
+   in if isString x
+      then parse x
+      else x.version or (parse x.name);
 
   /* Extract name with version from URL. Ask for separator which is
      supposed to start extension.