aboutsummaryrefslogtreecommitdiff
path: root/src/nix/flake.md
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/flake.md')
-rw-r--r--src/nix/flake.md32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/nix/flake.md b/src/nix/flake.md
index accddd436..f539a7c28 100644
--- a/src/nix/flake.md
+++ b/src/nix/flake.md
@@ -209,6 +209,38 @@ Currently the `type` attribute can be one of the following:
* `github:edolstra/dwarffs/unstable`
* `github:edolstra/dwarffs/d3f2baba8f425779026c6ec04021b2e927f61e31`
+* `sourcehut`: Similar to `github`, is a more efficient way to fetch
+ SourceHut repositories. The following attributes are required:
+
+ * `owner`: The owner of the repository (including leading `~`).
+
+ * `repo`: The name of the repository.
+
+ Like `github`, these are downloaded as tarball archives.
+
+ The URL syntax for `sourcehut` flakes is:
+
+ `sourcehut:<owner>/<repo>(/<rev-or-ref>)?(\?<params>)?`
+
+ `<rev-or-ref>` works the same as `github`. Either a branch or tag name
+ (`ref`), or a commit hash (`rev`) can be specified.
+
+ Since SourceHut allows for self-hosting, you can specify `host` as
+ a parameter, to point to any instances other than `git.sr.ht`.
+
+ Currently, `ref` name resolution only works for Git repositories.
+ You can refer to Mercurial repositories by simply changing `host` to
+ `hg.sr.ht` (or any other Mercurial instance). With the caveat
+ that you must explicitly specify a commit hash (`rev`).
+
+ Some examples:
+
+ * `sourcehut:~misterio/nix-colors`
+ * `sourcehut:~misterio/nix-colors/main`
+ * `sourcehut:~misterio/nix-colors?host=git.example.org`
+ * `sourcehut:~misterio/nix-colors/182b4b8709b8ffe4e9774a4c5d6877bf6bb9a21c`
+ * `sourcehut:~misterio/nix-colors/21c1a380a6915d890d408e9f22203436a35bb2de?host=hg.sr.ht`
+
* `indirect`: Indirections through the flake registry. These have the
form