README: Update flake support section

The wording is now a bit more clear
and directly related to our repository and project.
This commit is contained in:
Bryan Bennett 2022-04-07 10:01:52 -04:00
parent d3651bdd23
commit d8cff55741
No known key found for this signature in database
GPG key ID: EF90E3E98B8F5C0B

View file

@ -167,25 +167,36 @@ $ echo "use nix foo.nix" >> .envrc
## Flakes support ## Flakes support
nix-direnv also comes with a flake alternative. The code is tested and works however nix-direnv also comes with an alternative `use_flake` implementation.
since future nix versions might change their api regarding this feature we cannot The code is tested and does work but the upstream flake api is not finalized,
guarantee stability after an nix upgrade. so we we cannot guarantee stability after an nix upgrade.
Likewise `use_nix` the `use_flake` implementation will prevent garbage
collection of downloaded packages and also for flake inputs.
You can run `nix flake new -t github:nix-community/nix-direnv` to get [this](https://github.com/nix-community/nix-direnv/tree/master/template) project template. Like `use_nix`, our `use_flake` will prevent garbage collection of downloaded packages, including flake inputs.
or just add:
### Creating a new flake-native project
This repository ships with a flake template
which provides a basic flake with devShell integration and a basic `.envrc`.
To make use of this template, you may issue the following command:
```console
$ nix flake new -t github:nix-community/nix-direnv <desired output path>
``` ```
$ echo "use flake" >> .envrc
You can view the template [here](https://github.com/nix-community/nix-direnv/tree/master/template).
### Integrating with a existing flake
```console
$ echo "use flake" >> .direnvrc
$ direnv allow $ direnv allow
``` ```
in case the project already comes with a `flake.nix`. The `use flake` line also takes an additional arbitrary flake parameter,
Optionally if you do not want `flake.nix` to be part of the current directory repo, so you can point at external flakes as follows:
you can specify an arbitrary flake expression as parameter such as:
```console ```bash
use flake ~/myflakes#project use flake ~/myflakes#project
``` ```