nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 cmake,
4 fetchFromGitHub,
5 fetchpatch2,
6 gtest,
7 nix-update-script,
8 stdenv,
9 testers,
10 validatePkgConfig,
11}:
12
13stdenv.mkDerivation (finalAttrs: {
14 pname = "nbytes";
15 version = "0.1.2";
16
17 src = fetchFromGitHub {
18 owner = "nodejs";
19 repo = "nbytes";
20 tag = "v${finalAttrs.version}";
21 hash = "sha256-lsd1Qrv1HEz/5ry10s7Pq7unoh3y9ZmwCaT+6nTlxkc=";
22 };
23
24 patches = [
25 # Use `gtest` from Nixpkgs to allow an offline build
26 ./use-nix-googletest.patch
27 # Add support for pkgconfig for use as a shared lib
28 # TODO: remove when included in the next release
29 (fetchpatch2 {
30 url = "https://github.com/nodejs/nbytes/commit/00f48a0620cef800054d4aab061f09d89990a1b9.patch?full_index=1";
31 hash = "sha256-uOPEI70Dq446K56BSFHVyxDHNaYY5OASu3QeWGCLQmI=";
32 })
33 ];
34
35 outputs = [
36 "out"
37 ];
38
39 nativeBuildInputs = [
40 cmake
41 validatePkgConfig
42 ];
43 buildInputs = [
44 gtest
45 ];
46
47 cmakeFlags = [
48 (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
49 ];
50
51 passthru = {
52 updateScript = nix-update-script { };
53
54 tests.pkg-config = testers.hasPkgConfigModules {
55 package = finalAttrs.finalPackage;
56 };
57 };
58
59 meta = {
60 description = "Library of byte handling functions extracted from Node.js core";
61 homepage = "https://github.com/nodejs/nbytes";
62 changelog = "https://github.com/nodejs/nbytes/releases/tag/v${finalAttrs.version}";
63 license = lib.licenses.mit;
64 maintainers = with lib.maintainers; [ aduh95 ];
65 platforms = lib.platforms.all;
66 pkgConfigModules = [ "nbytes" ];
67 };
68})