summary refs log tree commit diff
path: root/lib/meta.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-03-10 15:01:56 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-03-10 15:01:56 +0100
commite167cf9f215ad94cdc9af73acfad251695c4fd7c (patch)
tree82135cde98ee5e57da143c65207ae728640f4915 /lib/meta.nix
parent1fe2a68224d3a28e79cb007805882f0e15c83526 (diff)
downloadnixpkgs-e167cf9f215ad94cdc9af73acfad251695c4fd7c.tar
nixpkgs-e167cf9f215ad94cdc9af73acfad251695c4fd7c.tar.gz
nixpkgs-e167cf9f215ad94cdc9af73acfad251695c4fd7c.tar.bz2
nixpkgs-e167cf9f215ad94cdc9af73acfad251695c4fd7c.tar.lz
nixpkgs-e167cf9f215ad94cdc9af73acfad251695c4fd7c.tar.xz
nixpkgs-e167cf9f215ad94cdc9af73acfad251695c4fd7c.tar.zst
nixpkgs-e167cf9f215ad94cdc9af73acfad251695c4fd7c.zip
Make appendToName do the right thing
I.e. append a suffix *before* the version, rather than after.  So we
get "sqlite-interactive-3.8.0.2" instead of
"sqlite-3.8.0.2-interactive".  The latter is broken since nix-env just
sees it the suffix as part of the version, so "nix-env -u" will
happily upgrade "sqlite-3.8.0.2-interactive" to "sqlite-3.9".
Diffstat (limited to 'lib/meta.nix')
-rw-r--r--lib/meta.nix9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/meta.nix b/lib/meta.nix
index 1af31473348..44e3cc011f1 100644
--- a/lib/meta.nix
+++ b/lib/meta.nix
@@ -31,11 +31,10 @@ rec {
   updateName = updater: drv: drv // {name = updater (drv.name);};
 
 
-  /* Append a suffix to the name of a package.  !!! the suffix should
-     really be appended *before* the version, at least most of the
-     time.
-  */
-  appendToName = suffix: updateName (name: "${name}-${suffix}");
+  /* Append a suffix to the name of a package (before the version
+     part). */
+  appendToName = suffix: updateName (name:
+    let x = builtins.parseDrvName name; in "${x.name}-${suffix}-${x.version}");
 
 
   /* Apply a function to each derivation and only to derivations in an attrset