Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchhg,
5 boost,
6 charls,
7 civetweb,
8 cmake,
9 curl,
10 dcmtk,
11 gtest,
12 jsoncpp,
13 libjpeg,
14 libpng,
15 libuuid,
16 log4cplus,
17 lua,
18 openssl,
19 protobuf,
20 pugixml,
21 python3,
22 sqlite,
23 unzip,
24 versionCheckHook,
25 nixosTests,
26 orthanc-framework,
27}:
28
29stdenv.mkDerivation (finalAttrs: {
30 pname = "orthanc";
31 version = "1.12.8";
32
33 src = fetchhg {
34 url = "https://orthanc.uclouvain.be/hg/orthanc/";
35 rev = "Orthanc-${finalAttrs.version}";
36 hash = "sha256-ktfTqCid/0aYAp5HPB7niZ1sw+zMNmd5mhZrXRbMGyk=";
37 };
38
39 outputs = [
40 "out"
41 "dev"
42 "doc"
43 ];
44
45 sourceRoot = "${finalAttrs.src.name}/OrthancServer";
46
47 nativeBuildInputs = [
48 cmake
49 protobuf
50 python3
51 unzip
52 ];
53
54 buildInputs = [
55 protobuf
56 boost
57 charls
58 civetweb
59 curl
60 dcmtk
61 gtest
62 jsoncpp
63 libjpeg
64 libpng
65 libuuid
66 log4cplus
67 lua
68 openssl
69 pugixml
70 sqlite
71 ];
72
73 strictDeps = true;
74
75 enableParallelBuilding = true;
76
77 cmakeFlags = [
78 (lib.cmakeFeature "DCMTK_DICTIONARY_DIR_AUTO" "${dcmtk}/share/dcmtk-${dcmtk.version}")
79 (lib.cmakeFeature "DCMTK_LIBRARIES" "dcmjpls;oflog;ofstd")
80 (lib.cmakeFeature "CMAKE_BUILD_TYPE" "Release")
81
82 (lib.cmakeBool "BUILD_CONNECTIVITY_CHECKS" false)
83 (lib.cmakeBool "UNIT_TESTS_WITH_HTTP_CONNEXIONS" false)
84 (lib.cmakeBool "STANDALONE_BUILD" true)
85 (lib.cmakeBool "USE_SYSTEM_BOOST" true)
86 (lib.cmakeBool "USE_SYSTEM_CIVETWEB" true)
87 (lib.cmakeBool "USE_SYSTEM_DCMTK" true)
88 (lib.cmakeBool "USE_SYSTEM_GOOGLE_TEST" true)
89 (lib.cmakeBool "USE_SYSTEM_JSONCPP" true)
90 (lib.cmakeBool "USE_SYSTEM_LIBICONV" true)
91 (lib.cmakeBool "USE_SYSTEM_LIBJPEG" true)
92 (lib.cmakeBool "USE_SYSTEM_LIBPNG" true)
93 (lib.cmakeBool "USE_SYSTEM_LUA" true)
94 (lib.cmakeBool "USE_SYSTEM_OPENSSL" true)
95 (lib.cmakeBool "USE_SYSTEM_PROTOBUF" true)
96 (lib.cmakeBool "USE_SYSTEM_PUGIXML" true)
97 (lib.cmakeBool "USE_SYSTEM_SQLITE" true)
98 (lib.cmakeBool "USE_SYSTEM_UUID" true)
99 (lib.cmakeBool "USE_SYSTEM_ZLIB" true)
100 ];
101
102 # Remove warnings during the build
103 env.NIX_CFLAGS_COMPILE = "-Wno-builtin-macro-redefined";
104
105 postInstall = ''
106 mkdir -p $doc/share/doc/orthanc
107 cp -r $src/OrthancServer/Resources/Samples $doc/share/doc/orthanc/Samples
108 cp -r $src/OrthancServer/Plugins/Samples $doc/share/doc/orthanc/OrthancPluginSamples
109 '';
110
111 nativeInstallCheckInputs = [
112 versionCheckHook
113 ];
114 versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}";
115 versionCheckProgramArg = "--version";
116 doInstallCheck = true;
117
118 passthru = {
119 framework = orthanc-framework;
120 tests = {
121 inherit (nixosTests) orthanc;
122 };
123 };
124
125 meta = {
126 description = "Orthanc is a lightweight, RESTful DICOM server for healthcare and medical research";
127 homepage = "https://www.orthanc-server.com/";
128 license = lib.licenses.gpl3Plus;
129 mainProgram = "Orthanc";
130 maintainers = with lib.maintainers; [ drupol ];
131 platforms = lib.platforms.linux;
132 };
133})