aboutsummaryrefslogtreecommitdiff
path: root/src/nix/flake.md
diff options
context:
space:
mode:
authorTony Olagbaiye <me@fron.io>2020-10-16 00:35:24 +0100
committerThéophane Hufschmitt <theophane.hufschmitt@tweag.io>2022-05-19 18:24:49 +0200
commit5b8c1deb18e0e6fc7a83fb8101cf5fc8dba38843 (patch)
treefab79fc57c3e461c03389d296760800e666018cb /src/nix/flake.md
parent78dc64ec1e34236d90c8869feebe30f596205cb2 (diff)
fetchTree: Allow fetching plain files
Add a new `file` fetcher type, which will fetch a plain file over http(s), or from the local file. Because plain `http(s)://` or `file://` urls can already correspond to `tarball` inputs (if the path ends-up with a know archive extension), the URL parsing logic is a bit convuluted in that: - {http,https,file}:// urls will be interpreted as either a tarball or a file input, depending on the extensions of the path part (so `https://foo.com/bar` will be a `file` input and `https://foo.com/bar.tar.gz` as a `tarball` input) - `file+{something}://` urls will be interpreted as `file` urls (with the `file+` part removed) - `tarball+{something}://` urls will be interpreted as `tarball` urls (with the `tarball+` part removed) Fix #3785 Co-Authored-By: Tony Olagbaiye <me@fron.io>
Diffstat (limited to 'src/nix/flake.md')
-rw-r--r--src/nix/flake.md14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/nix/flake.md b/src/nix/flake.md
index aa3f9f303..a1ab43281 100644
--- a/src/nix/flake.md
+++ b/src/nix/flake.md
@@ -181,9 +181,17 @@ Currently the `type` attribute can be one of the following:
* `tarball`: Tarballs. The location of the tarball is specified by the
attribute `url`.
- In URL form, the schema must be `http://`, `https://` or `file://`
- URLs and the extension must be `.zip`, `.tar`, `.tgz`, `.tar.gz`,
- `.tar.xz`, `.tar.bz2` or `.tar.zst`.
+ In URL form, the schema must be `tarball+http://`, `tarball+https://` or `tarball+file://`.
+ If the extension corresponds to a known archive format (`.zip`, `.tar`,
+ `.tgz`, `.tar.gz`, `.tar.xz`, `.tar.bz2` or `.tar.zst`), then the `tarball+`
+ can be dropped.
+
+* `file`: Plain files or directory tarballs, either over http(s) or from the local
+ disk.
+
+ In URL form, the schema must be `file+http://`, `file+https://` or `file+file://`.
+ If the extension doesn’t correspond to a known archive format (as defined by the
+ `tarball` fetcher), then the `file+` prefix can be dropped.
* `github`: A more efficient way to fetch repositories from
GitHub. The following attributes are required: