Skip to content

Commit

Permalink
Document the path flakeref format (#8640)
Browse files Browse the repository at this point in the history
* Document the path flakeref format

Fix #8482

Co-authored-by: Valentin Gagarin <[email protected]>
  • Loading branch information
thufschmitt and fricklerhandwerk authored Jul 4, 2023
1 parent 2898dc7 commit 82d6699
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/nix/flake.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ inputs.nixpkgs = {

Here are some examples of flake references in their URL-like representation:

* `.`: The flake in the current directory.
* `/home/alice/src/patchelf`: A flake in some other directory.
* `nixpkgs`: The `nixpkgs` entry in the flake registry.
* `nixpkgs/a3a3dda3bacf61e8a39258a0ed9c924eeca8e293`: The `nixpkgs`
entry in the flake registry, with its Git revision overridden to a
Expand All @@ -93,6 +91,23 @@ Here are some examples of flake references in their URL-like representation:
* `https://github.com/NixOS/patchelf/archive/master.tar.gz`: A tarball
flake.

## Path-like syntax

Flakes corresponding to a local path can also be referred to by a direct path reference, either `/absolute/path/to/the/flake` or `./relative/path/to/the/flake` (note that the leading `./` is mandatory for relative paths to avoid any ambiguity).

The semantic of such a path is as follows:

* If the directory is part of a Git repository, then the input will be treated as a `git+file:` URL, otherwise it will be treated as a `path:` url;
* If the directory doesn't contain a `flake.nix` file, then Nix will search for such a file upwards in the file system hierarchy until it finds any of:
1. The Git repository root, or
2. The filesystem root (/), or
3. A folder on a different mount point.

### Examples

* `.`: The flake to which the current directory belongs to.
* `/home/alice/src/patchelf`: A flake in some other directory.

## Flake reference attributes

The following generic flake reference attributes are supported:
Expand Down

0 comments on commit 82d6699

Please sign in to comment.