Skip to content

Commit

Permalink
documentation: use sections instead of list items
Browse files Browse the repository at this point in the history
  • Loading branch information
Solène Rapenne committed Dec 13, 2022
1 parent e43b0f5 commit 09860c1
Showing 1 changed file with 39 additions and 34 deletions.
73 changes: 39 additions & 34 deletions src/nix/flake.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,51 +18,56 @@ values such as packages or NixOS modules provided by the flake).
Flake references (*flakerefs*) are a way to specify the location of a
flake. These have two different forms:

* An attribute set representation, e.g.

```nix
{
type = "github";
owner = "NixOS";
repo = "nixpkgs";
}
```
## Attribute set representation

The only required attribute is `type`. The supported types are
listed below.
Example:

* A URL-like syntax, e.g.
```nix
{
type = "github";
owner = "NixOS";
repo = "nixpkgs";
}
```

```
github:NixOS/nixpkgs
```
The only required attribute is `type`. The supported types are
listed below.

These are used on the command line as a more convenient alternative
to the attribute set representation. For instance, in the command
## URL-like syntax

```console
# nix build github:NixOS/nixpkgs#hello
```
Example:

`github:NixOS/nixpkgs` is a flake reference (while `hello` is an
output attribute). They are also allowed in the `inputs` attribute
of a flake, e.g.
```
github:NixOS/nixpkgs
```

```nix
inputs.nixpkgs.url = github:NixOS/nixpkgs;
```
These are used on the command line as a more convenient alternative
to the attribute set representation. For instance, in the command

is equivalent to
```console
# nix build github:NixOS/nixpkgs#hello
```

```nix
inputs.nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
};
```
`github:NixOS/nixpkgs` is a flake reference (while `hello` is an
output attribute). They are also allowed in the `inputs` attribute
of a flake, e.g.

```nix
inputs.nixpkgs.url = github:NixOS/nixpkgs;
```

is equivalent to

```nix
inputs.nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
};
```

## Examples
### Examples

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

Expand Down

0 comments on commit 09860c1

Please sign in to comment.