1DIRENV-FETCHURL(1)               User Manuals               DIRENV-FETCHURL(1)
2
3
4

NAME

6       direnv fetchurl - Fetch a URL to disk
7
8

SYNOPSIS

10       direnv fetchurl  []
11
12

DESCRIPTION

14       This  command downloads the given URL into a fixed disk location, based
15       on the content of the retrieved file.
16
17
18       This has been introduced to avoid a dependency on curl or  wget,  while
19       also  promoting  a more secure way to fetch data from the Internet. Use
20       this instead of curl <url> | sh.
21
22
23       This command has two modes of operation:
24
25
26                1. Just pass the URL to discover the integrity hash.
27
28                2. Pass the URL and the integrity hash to get back the on-disk
29                   location.
30
31
32
33       Since  the  on-disk  location  is  based on the hash, it also acts as a
34       cache. One implication of this design is that URLs must be  stable  and
35       always return the same content.
36
37
38       Downloaded  files are marked as read-only and executable so it can also
39       be used to fetch and execute static binaries.
40
41

OPTIONS

43           A HTTP URL that returns content on HTTP GET requests. 301 and other
44           redirects are followed.
45
46
47           When passed, the integrity of the retrieved content will  be  vali‐
48       dated
49           against the given hash. The hash encoding is based on the SRI W3C
50           specificiation (see https://www.w3.org/TR/SRI/ ).
51
52

OUTPUT

54       direnv fetchurl outputs different content based on the argument.
55
56
57       If  the  integrity-hash is being passed, it will output the path to the
58       on-disk location, if the retrieval was successful.
59
60
61       If only the url is being passed, it will output the  hash  as  well  as
62       some  human-readable instruction. If stdout is not a tty, only the hash
63       will be displayed.
64
65

EXAMPLE

67              $ ./direnv fetchurl https://releases.nixos.org/nix/nix-2.3.7/install
68              Found hash: sha256-7Gxl5GzI9juc/U30Igh/pY+p6+gj5Waohfwql3jHIds=
69
70              Invoke fetchurl again with the hash as an argument to get the disk location:
71
72                direnv fetchurl "https://releases.nixos.org/nix/nix-2.3.7/install" "sha256-7Gxl5GzI9juc/U30Igh/pY+p6+gj5Waohfwql3jHIds="
73                #=> /home/zimbatm/.cache/direnv/cas/sha256-7Gxl5GzI9juc_U30Igh_pY+p6+gj5Waohfwql3jHIds=
74
75
76

ENVIRONMENT VARIABLES

78       XDG_CACHE_HOME
79           This variable is used to select the on-disk location of the fetched
80       URLs
81           as $XDG_CACHE_HOME/direnv/cas. If XDG_CACHE_HOME is unset or empty,
82           defaults to $HOME/.cache.
83
84
86       MIT licence - Copyright (C) 2019 @zimbatm and contributors
87
88

SEE ALSO

90       direnv-stdlib(1)
91
92
93
94direnv                               2019                   DIRENV-FETCHURL(1)
Impressum