Op Sun, 1 Mar 2015 12:21:04 -0300 Anderson Torres <torres.anderson...@gmail.com> schreef:
> Hello, Nixers! > > 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. > > And when I run nix-prefetch-url > "http://windowmaker.org/dockapps/?download=wmSMPmon-3.1.tar.gz" more > than once, it just outputs different hashes: > > > nix-prefetch-url > > http://windowmaker.org/dockapps/\?download\=wmSMPmon-3.1.tar.gz > % Total % Received % Xferd Average Speed Time Time > Time Current Dload Upload Total Spent Left Speed > 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 > --:--:-- 0 100 24113 0 24113 0 0 3809 0 > --:--:-- 0:00:06 --:--:-- 5139 path is > ‘/nix/store/lqri8zgmwz3mbf3q07kp62zl81bc6fpq-?download=wmSMPmon-3.1.tar.gz’ > 104bcfj4j0vlnr4v1fzahgj9amccn1aq7rjcpy1jyqnq6lbrmc3g > > > nix-prefetch-url > > http://windowmaker.org/dockapps/\?download\=wmSMPmon-3.1.tar.gz > % Total % Received % Xferd Average Speed Time Time > Time Current Dload Upload Total Spent Left Speed > 0 0 0 0 0 0 0 0 --:--:-- --:--:-- > --:--:-- 0 100 24110 0 24110 0 0 3193 0 > --:--:-- 0:00:07 --:--:-- 3985 path is > ‘/nix/store/f2b7rksjfh6ajddjhx09xb0jzc04jxg9-?download=wmSMPmon-3.1.tar.gz’ > 1s01whvf51jrwdmrk3bdgysaa2rzmh56c9p0kv3ydxijaagvqi2x > > How can I download it? Use the following code: src = fetchgit { url = git://repo.or.cz/dockapps.git; rev = "38c74350b02f35824554ce0c4f0f251d71762040"; sha256 = "0g9cwhlqg065fbhav4g4n16a4cqkk9jykl3y0zwbn5whhacfqyhl"; }; Explanation: When you download a dockapp from Windowmaker site you are redirected to a git repo site where you get a snapshot out of it. The id of the snapshot is the long hexadecimal string you are getting. The above code does a checkout of the whole dockapp-git directory. The only thing you have left to do is point to the directory where your actual dockapp is: postUnpack = "sourceRoot=\${sourceRoot}/dockapp-dir"; > _______________________________________________ > nix-dev mailing list > nix-dev@lists.science.uu.nl > http://lists.science.uu.nl/mailman/listinfo/nix-dev _______________________________________________ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev