diff --git a/.gitignore b/.gitignore index e746065908..f63aeb06b2 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,7 @@ userdata *.sqlite-shm # direnv +/.direnv /.envrc *.bat diff --git a/nix/README.md b/nix/README.md index c40547e3f4..5ee0c69c30 100644 --- a/nix/README.md +++ b/nix/README.md @@ -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, 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: ```shell nix-env -f nix/default.nix -i diff --git a/nix/envrc b/nix/envrc new file mode 100644 index 0000000000..fe397bdd79 --- /dev/null +++ b/nix/envrc @@ -0,0 +1,2 @@ +source_env nix/envrc-common +use nix nix/shell.nix diff --git a/nix/envrc-common b/nix/envrc-common new file mode 100644 index 0000000000..55aa08fc91 --- /dev/null +++ b/nix/envrc-common @@ -0,0 +1,4 @@ +watch_file nix/shell.nix +watch_file nix/common.nix +watch_file nix/sources.nix +watch_file nix/sources.json diff --git a/nix/envrc-nvidia b/nix/envrc-nvidia new file mode 100644 index 0000000000..a6f67b16d2 --- /dev/null +++ b/nix/envrc-nvidia @@ -0,0 +1,2 @@ +source_env nix/envrc-common +use nix nix/shell.nix --arg nvidia true