veloren/nix
2020-12-02 23:38:26 +03:00
..
Cargo.nix nix: update niv deps, regenerate Cargo.nix, add some comments and remove an unused variable 2020-12-02 23:38:26 +03:00
common.nix nix: update niv deps, regenerate Cargo.nix, add some comments and remove an unused variable 2020-12-02 23:38:26 +03:00
crate-hashes.json fix and improve nix build: actually output a proper veloren voxygen package now 2020-11-25 02:00:50 +03:00
default.nix nix: update niv deps, regenerate Cargo.nix, add some comments and remove an unused variable 2020-12-02 23:38:26 +03:00
envrc nix: envrc-common doesn't work apparently, so copy contents in it to both envrc-nvidia and envrc 2020-12-02 23:16:00 +03:00
envrc-nvidia nix: envrc-common doesn't work apparently, so copy contents in it to both envrc-nvidia and envrc 2020-12-02 23:16:00 +03:00
README.md nix: add .desktop file to veloren-voxygen derivation, update deps and other minor stuff 2020-12-01 00:15:18 +03:00
shell.nix nix: update niv deps, regenerate Cargo.nix, add some comments and remove an unused variable 2020-12-02 23:38:26 +03:00
sources.json nix: update niv deps, regenerate Cargo.nix, add some comments and remove an unused variable 2020-12-02 23:38:26 +03:00
sources.nix nix: dont run git-lfs shell hook if its already initialized, add experimental nix-bundle bundling command, add nixGL to shell.nix for non-nixos users, switch to nixpkgs-fmt for formatting, update niv deps and many other minor improvements 2020-11-30 03:48:00 +03:00

Important

If you are going to call the derivations with a custom nixpkgs argument, make sure that the nixpkgs you pass is on at least the same commit or newer than it. Unexpected errors may pop up if you use an older version. Same goes for the sources argument.

How to use

To enter the development shell (which includes all tools mentioned in this readme + tools you'll need to develop Veloren), run:

nix-shell nix/shell.nix

It is recommended that you enter the dev shell before starting to build using nix-build or nix-env (anything which build stuff), 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 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:

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:

nix-env -f nix/default.nix -i

You can configure what to install by changing the cratesToBuild argument:

nix-env -f nix/default.nix --arg cratesToBuild '["veloren-voxygen"]'

For example, this will install Voxygen only.

You can configure the crates to be built with debug mode (not recommended, equals to opt-level = 0):

nix-env -f nix/default.nix --arg release false

If you aren't on NixOS, you can run veloren-voxygen using the provided nixGLIntel in the dev shell:

nixGLIntel veloren-voxygen

If you have an Nvidia GPU, you can enter the dev shell like so:

nix-shell nix/shell.nix --arg nvidia true

And you'll be able to use nixGLNvidia and nixGLNvidiaBumblebee.

Managing Cargo.nix

Enter the development shell.

To update Cargo.nix (and crate-hashes.json) using latest Cargo.lock, run:

crate2nix generate -f ../Cargo.toml

Managing dependencies

We use niv to manage dependencies.

To update the dependencies, run (from repository root):

niv update

Formatting

Use nixpkgs-fmt to format files.

To format every Nix file:

nixpkgs-fmt nix/*.nix