summary refs log tree commit diff
path: root/pkgs/lib/strings.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/lib/strings.nix')
-rw-r--r--pkgs/lib/strings.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkgs/lib/strings.nix b/pkgs/lib/strings.nix
index 4bd7a5bebde..19d1738182f 100644
--- a/pkgs/lib/strings.nix
+++ b/pkgs/lib/strings.nix
@@ -155,6 +155,12 @@ rec {
   # Return true iff string v1 denotes a version older than v2.
   versionOlder = v1: v2: builtins.compareVersions v2 v1 == 1;
 
+
+  # Get the version of the specified derivation, as specified in its
+  # ‘name’ attribute.
+  getVersion = drv: (builtins.parseDrvName drv.name).version;
+
+
   # Extract name with version from URL. Ask for separator which is 
   # supposed to start extension
   nameFromURL = url: sep: let