nixpkgs/pkgs/development/tools/rust/cargo-raze/default.nix
Dmitry Ivankov df4fef87c5 cargo-raze: increase open file descriptors limits for tests on darwin
https://hydra.nixos.org/build/239024688/nixlog/2
https://hydra.nixos.org/build/239009073/nixlog/2
```
thread '<unnamed>' panicked at 'Cannot build local tokio runtime: Os { code: 24, kind: Uncategorized, message: "Too many open files" }', /private/tmp/nix-build-cargo-raze-0.16.0.drv-0/cargo-raze-0.16.0-vendor.tar.gz/httpmock/src/lib.rs:1436:14
```

Seems to be a typical darwin failure, some packages already bump
file descriptors limit to 1024 (same as default in some Linux distros,
default darwin value seems to be 256 these days)

Also has a report upstream
https://github.com/google/cargo-raze/issues/544

ZHF: #265948
2023-11-13 19:30:21 +01:00

49 lines
1.1 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, pkg-config
, curl
, libgit2
, openssl
, Security
}:
rustPlatform.buildRustPackage rec {
pname = "cargo-raze";
version = "0.16.0";
src = fetchFromGitHub {
owner = "google";
repo = pname;
rev = "v${version}";
hash = "sha256-ip0WuBn1b7uN/pAhOl5tfmToK73ZSHK7rucdtufsbCQ=";
};
sourceRoot = "${src.name}/impl";
cargoHash = "sha256-hNZgQwhm4UPqmANplZGxG0DYHa31tu06nmqYaCA7Vdg=";
nativeBuildInputs = [ pkg-config ];
buildInputs = [
libgit2
openssl
curl
]
++ lib.optional stdenv.isDarwin Security;
preCheck = lib.optionalString stdenv.isDarwin ''
# Darwin issue: Os { code: 24, kind: Uncategorized, message: "Too many open files" }
# https://github.com/google/cargo-raze/issues/544
ulimit -n 1024
'';
__darwinAllowLocalNetworking = true;
meta = with lib; {
description = "Generate Bazel BUILD files from Cargo dependencies";
homepage = "https://github.com/google/cargo-raze";
license = licenses.asl20;
maintainers = with maintainers; [ elasticdog ];
};
}