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.md49
1 files changed, 39 insertions, 10 deletions
diff --git a/src/nix/flake.md b/src/nix/flake.md
index 3b5812a0a..d59915eeb 100644
--- a/src/nix/flake.md
+++ b/src/nix/flake.md
@@ -137,15 +137,6 @@ Currently the `type` attribute can be one of the following:
*path* must be a directory in the file system containing a file
named `flake.nix`.
- If the directory or any of its parents is a Git repository, then
- this is essentially equivalent to `git+file://<path>` (see below),
- except that the `dir` parameter is derived automatically. For
- example, if `/foo/bar` is a Git repository, then the flake reference
- `/foo/bar/flake` is equivalent to `/foo/bar?dir=flake`.
-
- If the directory is not inside a Git repository, then the flake
- contents is the entire contents of *path*.
-
*path* generally must be an absolute path. However, on the command
line, it can be a relative path (e.g. `.` or `./foo`) which is
interpreted as relative to the current directory. In this case, it
@@ -218,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
@@ -245,7 +268,7 @@ derivation):
outputs = { self, nixpkgs }: {
- defaultPackage.x86_64-linux =
+ packages.x86_64-linux.default =
# Notice the reference to nixpkgs here.
with import nixpkgs { system = "x86_64-linux"; };
stdenv.mkDerivation {
@@ -301,6 +324,12 @@ The following attributes are supported in `flake.nix`:
value (e.g. `packages.x86_64-linux` must be an attribute set of
derivations built for the `x86_64-linux` platform).
+* `nixConfig`: a set of `nix.conf` options to be set when evaluating any
+ part of a flake. In the interests of security, only a small set of
+ whitelisted options (currently `bash-prompt`, `bash-prompt-suffix`,
+ and `flake-registry`) are allowed to be set without confirmation so long as
+ `accept-flake-config` is not set in the global configuration.
+
## Flake inputs
The attribute `inputs` specifies the dependencies of a flake, as an