Cargo.nix override instead of requiring manual intervention

This commit is contained in:
Ludvig Böklin 2020-12-17 11:42:40 +01:00
parent 52c37e1de0
commit 0b4aeb5794
3 changed files with 10 additions and 8 deletions

View File

@ -1,6 +0,0 @@
Apply these instructions after generating the `Cargo.nix` file.
- Find `veloren-common` crate in `Cargo.nix`:
- Comment the `optional = true;` line for "structopt" and "csv" dependencies.
- See [this issue](https://github.com/kolloch/crate2nix/issues/129) on `crate2nix` repository for more info.
- Note that the suggested workaround in the issue **does not** work for us.

View File

@ -192,7 +192,6 @@ To update `Cargo.nix` (and `crate-hashes.json`) using latest `Cargo.lock`, run:
```shell ```shell
crate2nix generate -f ../Cargo.toml crate2nix generate -f ../Cargo.toml
``` ```
Then follow the instructions in the `Cargo.nix_patches.md` file.
### Rust toolchain ### Rust toolchain

View File

@ -73,7 +73,16 @@ let
callPackage ./Cargo.nix { callPackage ./Cargo.nix {
defaultCrateOverrides = with common; with crateDeps; defaultCrateOverrides = with common; with crateDeps;
defaultCrateOverrides // { defaultCrateOverrides // {
veloren-common = _: { veloren-common = oldAttrs: {
# see: https://github.com/kolloch/crate2nix/issues/129
dependencies =
map
(dep:
if dep.name == "csv" || dep.name == "structopt"
then builtins.removeAttrs dep [ "optional" ]
else dep)
oldAttrs.dependencies;
# Disable `git-lfs` check here since we check it ourselves # Disable `git-lfs` check here since we check it ourselves
# We have to include the command output here, otherwise Nix won't run it # We have to include the command output here, otherwise Nix won't run it
DISABLE_GIT_LFS_CHECK = utils.isGitLfsSetup common.gitLfsCheckFile; DISABLE_GIT_LFS_CHECK = utils.isGitLfsSetup common.gitLfsCheckFile;