From 0b4aeb5794e9f9659388dea34642be8d089d2101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20B=C3=B6klin?= Date: Thu, 17 Dec 2020 11:42:40 +0100 Subject: [PATCH] Cargo.nix override instead of requiring manual intervention --- nix/Cargo.nix_patches.md | 6 ------ nix/README.md | 1 - nix/veloren.nix | 11 ++++++++++- 3 files changed, 10 insertions(+), 8 deletions(-) delete mode 100644 nix/Cargo.nix_patches.md diff --git a/nix/Cargo.nix_patches.md b/nix/Cargo.nix_patches.md deleted file mode 100644 index 39ef390580..0000000000 --- a/nix/Cargo.nix_patches.md +++ /dev/null @@ -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. diff --git a/nix/README.md b/nix/README.md index cd0de67841..b5f8812859 100644 --- a/nix/README.md +++ b/nix/README.md @@ -192,7 +192,6 @@ To update `Cargo.nix` (and `crate-hashes.json`) using latest `Cargo.lock`, run: ```shell crate2nix generate -f ../Cargo.toml ``` -Then follow the instructions in the `Cargo.nix_patches.md` file. ### Rust toolchain diff --git a/nix/veloren.nix b/nix/veloren.nix index e7b2912aff..c08457b117 100644 --- a/nix/veloren.nix +++ b/nix/veloren.nix @@ -73,7 +73,16 @@ let callPackage ./Cargo.nix { defaultCrateOverrides = with common; with crateDeps; 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 # We have to include the command output here, otherwise Nix won't run it DISABLE_GIT_LFS_CHECK = utils.isGitLfsSetup common.gitLfsCheckFile;