[Nix-dev] Fetching variable and unpredictable URL download link

Eelco Dolstra eelco.dolstra at logicblox.com
Mon Mar 2 14:41:01 CET 2015


Hi,

On 01/03/15 16:21, Anderson Torres wrote:

> How can I "fetchurl" a variable url?
> 
> When I download a dockapp from Windowmaker site, like
> 
> "http://windowmaker.org/dockapps/?download=wmSMPmon-3.1.tar.gz",
> 
> it in fact downloads something like "wmSMPmon-${a long string of
> chars, like a checksum}.tar.gz". And the long string is unpredictable.

You can use fetchzip instead:

  fetchzip rec {
    name = "wmSMPmon-3.1.tar.gz";
    url = "http://windowmaker.org/dockapps/?download=${name}";
    sha256 = "1ahp2vg6w3pzg0aar61gm122q37ljhd8ni6g0p1vp0x1wbavgljl";
  }

It calculates the hash over the unpacked data, so changes in the mtime fields of
the archive and other metadata don't matter.

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/


More information about the nix-dev mailing list