nix: add envrc and envrc-nvidia file for auto dev env setup with direnv

This commit is contained in:
Yusuf Bera Ertan 2020-11-30 17:35:53 +03:00
parent 3c7d682361
commit bb1a481d1d
No known key found for this signature in database
GPG Key ID: 1D8F8FAF2294D6EA
5 changed files with 16 additions and 0 deletions

1
.gitignore vendored
View File

@ -42,6 +42,7 @@ userdata
*.sqlite-shm *.sqlite-shm
# direnv # direnv
/.direnv
/.envrc /.envrc
*.bat *.bat

View File

@ -8,6 +8,13 @@ It is recommended that you enter the dev shell before starting to build using `n
since it will setup a Cachix cache for you. (you can configure this for your user's `nix.conf` by running `cachix use veloren-nix` once in the dev shell, since it will setup a Cachix cache for you. (you can configure this for your user's `nix.conf` by running `cachix use veloren-nix` once in the dev shell,
which will make the cache available when you run commands outside of the dev shell). which will make the cache available when you run commands outside of the dev shell).
If you have [direnv](https://direnv.net) setup on your system, it is also recommended to copy the `envrc`
(or `envrc-nvidia`, if you have an Nvidia GPU) file to the root of the repository as `.envrc`:
```shell
cp nix/envrc .envrc
```
This will make your env have the dev env setup automatically.
To build and install Voxygen and the server CLI into user profile, run: To build and install Voxygen and the server CLI into user profile, run:
```shell ```shell
nix-env -f nix/default.nix -i nix-env -f nix/default.nix -i

2
nix/envrc Normal file
View File

@ -0,0 +1,2 @@
source_env nix/envrc-common
use nix nix/shell.nix

4
nix/envrc-common Normal file
View File

@ -0,0 +1,4 @@
watch_file nix/shell.nix
watch_file nix/common.nix
watch_file nix/sources.nix
watch_file nix/sources.json

2
nix/envrc-nvidia Normal file
View File

@ -0,0 +1,2 @@
source_env nix/envrc-common
use nix nix/shell.nix --arg nvidia true