direnvrc: Add nix_direnv_version

In the style of direnv's `direnv_version`.
729fbecd96/stdlib.go (L1173-L1179)

Can be tested for with `has`, e.g. to decide on using `source_url`.
This commit is contained in:
bb010g 2021-05-16 00:53:45 -07:00 committed by Jörg Thalheim
parent adfca0d26d
commit 9f40e3b1c3
No known key found for this signature in database
GPG key ID: B3F5D81B0C6967C4
3 changed files with 41 additions and 4 deletions

View file

@ -123,10 +123,12 @@ via home-manager section.
### Direnv source_url
Put the following line in your .envrc
Put the following lines in your `.envrc`:
```bash
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/1.2.6/direnvrc" "sha256-jidqAtTK64MJxz1fd394P1RNUZW5Jd8OFgO2nNg2gJU="
if ! has nix_direnv_version || ! nix_direnv_version 1.2.6; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/1.2.6/direnvrc" "sha256-jidqAtTK64MJxz1fd394P1RNUZW5Jd8OFgO2nNg2gJU="
fi
```
## Usage example