Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 69 lines 1.5 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 cmake, 6 cmocka, 7 8 # for passthru.tests 9 libfido2, 10 mysql80, 11 openssh, 12 systemd, 13}: 14 15stdenv.mkDerivation (finalAttrs: { 16 pname = "libcbor"; 17 version = "0.12.0"; 18 19 src = fetchFromGitHub { 20 owner = "PJK"; 21 repo = "libcbor"; 22 rev = "v${finalAttrs.version}"; 23 hash = "sha256-13iwjc1vrTgBhWRg4vpLmlrEoxA9DSuXIOz4R9cXXEc="; 24 }; 25 26 outputs = [ 27 "out" 28 "dev" 29 ]; 30 31 strictDeps = true; 32 nativeBuildInputs = [ cmake ]; 33 34 buildInputs = [ 35 cmocka # cmake expects cmocka module 36 ]; 37 38 # BUILD file already exists in the source 39 # TODO: make unconditional on staging. 40 cmakeBuildDir = if stdenv.isDarwin then "build.dir" else null; 41 42 cmakeFlags = 43 lib.optional finalAttrs.finalPackage.doCheck "-DWITH_TESTS=ON" 44 ++ lib.optional (!stdenv.hostPlatform.isStatic) "-DBUILD_SHARED_LIBS=ON"; 45 46 # Tests are restricted while pkgsStatic.cmocka is broken. Tracked at: 47 # https://github.com/NixOS/nixpkgs/issues/213623 48 doCheck = !stdenv.hostPlatform.isStatic && stdenv.hostPlatform == stdenv.buildPlatform; 49 50 nativeCheckInputs = [ cmocka ]; 51 52 passthru.tests = { 53 inherit libfido2 mysql80; 54 openssh = (openssh.override { withFIDO = true; }); 55 systemd = ( 56 systemd.override { 57 withFido2 = true; 58 withCryptsetup = true; 59 } 60 ); 61 }; 62 63 meta = with lib; { 64 description = "CBOR protocol implementation for C and others"; 65 homepage = "https://github.com/PJK/libcbor"; 66 license = licenses.mit; 67 maintainers = [ ]; 68 }; 69})