1{ stdenv, lib, fetchFromGitHub, autoconf, automake, libtool, pkgconfig
2, ApplicationServices, CoreServices }:
3
4stdenv.mkDerivation rec {
5 version = "1.19.2";
6 name = "libuv-${version}";
7
8 src = fetchFromGitHub {
9 owner = "libuv";
10 repo = "libuv";
11 rev = "v${version}";
12 sha256 = "118r8wigm65107fm7kzfz7gc4awy8xxg0knvwnshx1j40ks08x9z";
13 };
14
15 postPatch = let
16 toDisable = [
17 "getnameinfo_basic" "udp_send_hang_loop" # probably network-dependent
18 "spawn_setuid_fails" "spawn_setgid_fails" "fs_chown" # user namespaces
19 "getaddrinfo_fail" "getaddrinfo_fail_sync"
20 "threadpool_multiple_event_loops" # times out on slow machines
21 ]
22 # sometimes: timeout (no output), failed uv_listen
23 ++ stdenv.lib.optionals stdenv.isDarwin [ "process_title" "emfile" ];
24 tdRegexp = lib.concatStringsSep "\\|" toDisable;
25 in lib.optionalString doCheck ''
26 sed '/${tdRegexp}/d' -i test/test-list.h
27 '';
28
29 nativeBuildInputs = [ automake autoconf libtool pkgconfig ];
30 buildInputs = stdenv.lib.optionals stdenv.isDarwin [ ApplicationServices CoreServices ];
31
32 preConfigure = ''
33 LIBTOOLIZE=libtoolize ./autogen.sh
34 '';
35
36 enableParallelBuilding = true;
37
38 # These should be turned back on, but see https://github.com/NixOS/nixpkgs/issues/23651
39 # For now the tests are just breaking large swaths of the nixpkgs binary cache for Darwin,
40 # and I'd rather have everything else work at all than have stronger assurance here.
41 doCheck = !stdenv.isDarwin;
42
43 meta = with lib; {
44 description = "A multi-platform support library with a focus on asynchronous I/O";
45 homepage = https://github.com/libuv/libuv;
46 maintainers = with maintainers; [ cstrahan ];
47 platforms = with platforms; linux ++ darwin;
48 };
49
50}