vscode-extensions.yoavbls.pretty-ts-errors: 0.5.4 -> 0.6.1 (#363464)
[NixPkgs.git] / pkgs / by-name / sg / sgx-azure-dcap-client / package.nix
blob2ccace2d3c27f9336f64bc645fa2c74e08979860
2   stdenv,
3   fetchFromGitHub,
4   fetchpatch,
5   lib,
6   curl,
7   nlohmann_json,
8   openssl,
9   pkg-config,
10   linkFarmFromDrvs,
11   callPackage,
13 let
14   # Although those headers are also included in the source of `sgx-psw`, the `azure-dcap-client` build needs specific versions
15   filterSparse = list: ''
16     cp -r "$out"/. .
17     find "$out" -mindepth 1 -delete
18     cp ${lib.concatStringsSep " " list} "$out/"
19   '';
20   headers = linkFarmFromDrvs "azure-dcap-client-intel-headers" [
21     (fetchFromGitHub rec {
22       name = "${repo}-headers";
23       owner = "intel";
24       repo = "linux-sgx";
25       # See: <src/Linux/configure> for the revision `azure-dcap-client` uses.
26       rev = "1ccf25b64abd1c2eff05ead9d14b410b3c9ae7be";
27       hash = "sha256-WJRoS6+NBVJrFmHABEEDpDhW+zbWFUl65AycCkRavfs=";
28       sparseCheckout = [
29         "common/inc/sgx_report.h"
30         "common/inc/sgx_key.h"
31         "common/inc/sgx_attributes.h"
32       ];
33       postFetch = filterSparse sparseCheckout;
34     })
35   ];
37 stdenv.mkDerivation rec {
38   pname = "azure-dcap-client";
39   version = "1.12.3";
41   src = fetchFromGitHub {
42     owner = "microsoft";
43     repo = pname;
44     rev = version;
45     hash = "sha256-zTDaICsSPXctgFRCZBiZwXV9dLk2pFL9kp5a8FkiTZA=";
46   };
48   patches = [
49     # Fix gcc-13 build:
50     #   https://github.com/microsoft/Azure-DCAP-Client/pull/197
51     (fetchpatch {
52       name = "gcc-13.patch";
53       url = "https://github.com/microsoft/Azure-DCAP-Client/commit/fbcae7b3c8f1155998248cf5b5f4c1df979483f5.patch";
54       hash = "sha256-ezEuQql3stn58N1ZPKMlhPpUOBkDpCcENpGwFAmWtHc=";
55     })
56   ];
58   nativeBuildInputs = [
59     pkg-config
60   ];
62   buildInputs = [
63     curl
64     nlohmann_json
65     openssl
66   ];
68   postPatch = ''
69     mkdir -p src/Linux/ext/intel
70     find -L '${headers}' -type f -exec ln -s {} src/Linux/ext/intel \;
72     substitute src/Linux/Makefile{.in,} \
73       --replace-fail '##CURLINC##' '${curl.dev}/include/curl/' \
74       --replace-fail '$(TEST_SUITE): $(PROVIDER_LIB) $(TEST_SUITE_OBJ)' '$(TEST_SUITE): $(TEST_SUITE_OBJ)'
75   '';
77   env.NIX_CFLAGS_COMPILE = "-Wno-deprecated-declarations";
79   makeFlags = [
80     "-C src/Linux"
81     "prefix=$(out)"
82   ];
84   # Online test suite; run with
85   # $(nix-build -A sgx-azure-dcap-client.tests.suite)/bin/tests
86   passthru.tests.suite = callPackage ./test-suite.nix { };
88   meta = {
89     description = "Interfaces between SGX SDKs and the Azure Attestation SGX Certification Cache";
90     homepage = "https://github.com/microsoft/azure-dcap-client";
91     maintainers = with lib.maintainers; [
92       phlip9
93       trundle
94       veehaitch
95     ];
96     platforms = [ "x86_64-linux" ];
97     license = [ lib.licenses.mit ];
98   };