about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/cpp-jwt
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/cpp-jwt')
-rw-r--r--nixpkgs/pkgs/development/libraries/cpp-jwt/default.nix34
-rw-r--r--nixpkgs/pkgs/development/libraries/cpp-jwt/fix-version.patch12
2 files changed, 46 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/cpp-jwt/default.nix b/nixpkgs/pkgs/development/libraries/cpp-jwt/default.nix
new file mode 100644
index 000000000000..7f55913b85bf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cpp-jwt/default.nix
@@ -0,0 +1,34 @@
+{ lib, stdenv, fetchFromGitHub, cmake, openssl, gtest, nlohmann_json }:
+
+stdenv.mkDerivation rec {
+  pname = "cpp-jwt";
+  version = "1.4";
+
+  src = fetchFromGitHub {
+    owner = "arun11299";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-5hVsFanTCT/uLLXrnb2kMvmL6qs9RXVkvxdWaT6m4mk=";
+  };
+
+  # fix reported version
+  patches = [ ./fix-version.patch ];
+
+  cmakeFlags = [
+    "-DCPP_JWT_USE_VENDORED_NLOHMANN_JSON=OFF"
+    "-DCPP_JWT_BUILD_EXAMPLES=OFF"
+  ];
+
+  nativeBuildInputs = [ cmake gtest ];
+
+  buildInputs = [ openssl nlohmann_json ];
+
+  doCheck = true;
+
+  meta = {
+    description = "JSON Web Token library for C++";
+    homepage = "https://github.com/arun11299/cpp-jwt";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ fpletz ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/cpp-jwt/fix-version.patch b/nixpkgs/pkgs/development/libraries/cpp-jwt/fix-version.patch
new file mode 100644
index 000000000000..d04525e15464
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/cpp-jwt/fix-version.patch
@@ -0,0 +1,12 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2f35431..f08eb22 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,5 +1,5 @@
+ cmake_minimum_required(VERSION 3.5.0)
+-project(cpp-jwt VERSION 1.2.0)
++project(cpp-jwt VERSION 1.4.0)
+ 
+ option(CPP_JWT_BUILD_EXAMPLES "build examples" ON)
+ option(CPP_JWT_BUILD_TESTS "build tests" ON)
+ 
\ No newline at end of file