[Nix-dev] restricted downloads
Marc Weber
marco-oweber at gmx.de
Mon May 3 00:26:37 CEST 2010
Excerpts from Eelco Dolstra's message of Sun May 02 23:23:14 +0200 2010:
> Hi,
>
> On 04/30/2010 10:47 PM, Yury G. Kudryashov wrote:
>
> > I've just commited support for "restricted downloads" in fetchurl. The idea
> > is that you can write
> > src = fetchurl {
> > url = "http://restricted.noltd/download.html";
> > name = "my_restricted_src.zip";
> > restricted = true;
> > sha256 = "myhash";
> > };
>
> This is an abuse of fetchurl. You should have a different fixed-output
> derivation function that always fails (say, `requireFile { name = ...; sha256 =
> ...; errorMessage = ...; }') - there is no need to use fetchurl for this purpose.
>
Something like this?
Maybe people download stuff into /tmp anyway?
fetchurlRestricted = {name, sha256, info ...}@args:
let path = "/tmp/manual-download-required/${name}";
if builtins.pathExists path
then stdenv.fetchurl (args // { url = "file://${path}"; } );
else throw "create path ${path}: ${info}";
where info is something like
"goto www.game.com, click on download, accept license, download xx.y file"
This would be
Marc Weber
More information about the nix-dev
mailing list