[Nix-dev] Getting package name & version from URL
Marc Weber
marco-oweber at gmx.de
Sun Aug 3 13:11:25 CEST 2008
On Sun, Aug 03, 2008 at 12:05:48PM +0200, Pjotr Prins wrote:
> Quite a few packages have duplications of version numbers hard-coded.
> One way to prevent that is defining a variable 'version'. It would
> even be easier if we could get the version from the fetchurl (with the
> name of the package) as the URL often gets changed first, when
> updating a package.
>
> Would be a nice to have.
How would it look like ?
# name can be "", in this case it will be taken from the url as well
let makeName url name =
if name == "" then __getNameAndVersionFromURL url
else name ++ "-" ++ __getVersionFromURL url
; in
addName attr = attr // { name = makeName attr.src.url ( lib.getAttr [ "name" ] "" attr ); }
?
Marc
More information about the nix-dev
mailing list