nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 cmake,
3 fetchFromGitHub,
4 fetchpatch2,
5 glibcLocales,
6 lib,
7 meson,
8 ninja,
9 nix-update-script,
10 pkg-config,
11 stdenv,
12 testers,
13}:
14
15stdenv.mkDerivation (finalAttrs: {
16 pname = "tomlplusplus";
17 version = "3.4.0";
18
19 src = fetchFromGitHub {
20 owner = "marzer";
21 repo = "tomlplusplus";
22 tag = "v${finalAttrs.version}";
23 hash = "sha256-h5tbO0Rv2tZezY58yUbyRVpsfRjY3i+5TPkkxr6La8M=";
24 };
25
26 patches = [
27 # TODO: Remove this patch at the next update
28 # https://github.com/marzer/tomlplusplus/pull/233
29 (fetchpatch2 {
30 name = "tomlplusplus-install-example-programs.patch";
31 url = "https://github.com/marzer/tomlplusplus/commit/8128eb632325d1820f4d17dd8250dcda6ab07743.patch";
32 hash = "sha256-7m2P+e1/OASHrzm9LSy6RnayS/kGxFC82xOyGBGXeG0=";
33 })
34 ];
35
36 nativeBuildInputs = [
37 meson
38 cmake
39 ninja
40 pkg-config
41 ];
42
43 checkInputs = [
44 glibcLocales
45 ];
46
47 mesonFlags = [
48 "-Dbuild_tests=${lib.boolToString finalAttrs.finalPackage.doCheck}"
49 "-Dbuild_examples=true"
50 ];
51
52 # almost all tests fail on Darwin with the following exception:
53 # libc++abi: terminating due to uncaught exception of type std::runtime_error: collate_byname<char>::collate_byname failed to construct for
54 doCheck = !stdenv.hostPlatform.isDarwin;
55
56 passthru = {
57 updateScript = nix-update-script { };
58 tests.pkg-config = testers.hasPkgConfigModules {
59 package = finalAttrs.finalPackage;
60 };
61 };
62
63 meta = {
64 homepage = "https://github.com/marzer/tomlplusplus";
65 description = "Header-only TOML config file parser and serializer for C++17";
66 license = lib.licenses.mit;
67 maintainers = with lib.maintainers; [ Scrumplex ];
68 pkgConfigModules = [ "tomlplusplus" ];
69 platforms = lib.platforms.unix;
70 };
71})