DIRENV-FETCHURL(1)
π NAME π
okay bestie, meet direnv-fetchurl(1) from the User Manuals set β itβs literally called Fetch a URL to disk and it does exactly what it says π
β¨ SYNOPSIS β¨
direnv fetchurl <url> [<integrity-hash>]
π DESCRIPTION π
This command downloads the URL you give it into a fixed disk location, based on the content of the retrieved file. Iconic behavior, no notes.
It exists so you donβt have to depend on curl or wget, while also promoting a more secure way to fetch data from the Internet. Use this instead of curl <url> | sh π«Ά
This command has two modes of operation:
- Just pass the URL to discover the integrity hash.
- Pass the URL and the integrity hash to get back the on-disk location.
Since the on-disk location is based on the hash, it also acts as a cache. One implication of this design is that URLs must be stable and always return the same content. No sneaky changing files, bestie π
Downloaded files are marked as read-only and executable so it can also be used to fetch and execute static binaries. main character energy fr fr π₯
π OPTIONS π
<url>β A HTTP URL that returns content on HTTP GET requests.301and other redirects are followed.<integrity-hash>β When passed, the integrity of the retrieved content will be validated against the given hash. The hash encoding is based on the SRI W3C specification (seehttps://www.w3.org/TR/SRI/).
π OUTPUT π
direnv fetchurl outputs different content based on the argument.
If the integrity-hash is being passed, it will output the path to the on-disk location, if the retrieval was successful.
If only the url is being passed, it will output the hash as well as some human-readable instruction. If stdout is not a tty, only the hash will be displayed.
π¦ EXAMPLE π¦
$ ./direnv fetchurl https://releases.nixos.org/nix/nix-2.3.7/install
Found hash: sha256-7Gxl5GzI9juc/U30Igh/pY+p6+gj5Waohfwql3jHIds=
Invoke fetchurl again with the hash as an argument to get the disk location:
direnv fetchurl "https://releases.nixos.org/nix/nix-2.3.7/install" "sha256-7Gxl5GzI9juc/U30Igh/pY+p6+gj5Waohfwql3jHIds="
#=> /home/zimbatm/.cache/direnv/cas/sha256-7Gxl5GzI9juc_U30Igh_pY+p6+gj5Waohfwql3jHIds=
π ENVIRONMENT VARIABLES π
XDG_CACHE_HOMEβ This variable is used to select the on-disk location of the fetched URLs as$XDG_CACHE_HOME/direnv/cas. IfXDG_CACHE_HOMEis unset or empty, defaults to$HOME/.cache.
π COPYRIGHT π
MIT licence - Copyright (C) 2019 @zimbatm and contributors
π SEE ALSO π
byeeeee π β this cutie is from direnv, dated 2019, and yes itβs the DIRENV-FETCHURL(1) manual. periodt β¨
π¦ where this page comes from
- arch rolling: direnv 2.38.2-1 Β· MIT
- nixpkgs unstable: direnv 2.38.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms