@@ -1,149 +0,0 @@
1−{ stdenv, lib, fetchFromGitHub, pkgconfig, cmake, python
2−, udev, audit, aws-sdk-cpp, cryptsetup, lvm2, libgcrypt, libarchive
3−, libgpgerror, libuuid, iptables, dpkg, lzma, bzip2, rpm
4−, beecrypt, augeas, libxml2, sleuthkit, yara, lldpd, gflags
5−, thrift, boost, rocksdb_lite, glog, gbenchmark, snappy
6−, openssl, file, doxygen
7−, gtest, fpm, zstd, rdkafka, rapidjson, fetchgit, fetchurl, libelfin
8−, smartmontools, which, git, cscope, ctags, ssdeep
9−}:
10−
11−let
12− overrides = {
13− # use older `lvm2` source for osquery, the 2.03 sourcetree
14− # will break osquery due to the lacking header `lvm2app.h`.
15− #
16− # https://github.com/NixOS/nixpkgs/pull/51756#issuecomment-446035295
17− lvm2 = lvm2.overrideAttrs (old: rec {
18− name = "lvm2-${version}";
19− version = "2.02.183";
20− src = fetchgit {
21− url = "git://sourceware.org/git/lvm2.git";
22− rev = "v${version}";
23− sha256 = "1ny3srcsxd6kj59zq1cman5myj8kzw010wbyc6mrpk4kp823r5nx";
24− };
25− });
26−
27− # use smartmontools fork to programatically retrieve SMART information.
28− # https://github.com/facebook/osquery/pull/4133
29− smartmontools = smartmontools.overrideAttrs (old: rec {
30− name = "smartmontools-${version}";
31− version = "0.3.1";
32− src = fetchFromGitHub {
33− owner = "allanliu";
34− repo = "smartmontools";
35− rev = "v${version}";
36− sha256 = "1i72fk2ranrky02h7nh9l3va4kjzj0lx1gr477zkxd44wf3w0pjf";
37− };
38−
39− # Apple build fix doesn't apply here and isn't needed as we
40− # only support `osquery` on Linux.
41− patches = [];
42− });
43−
44− # dpkg 1.19.2 dropped api in `<dpkg/dpkg-db.h>` which breaks compilation.
45− dpkg = dpkg.overrideAttrs (old: rec {
46− name = "dpkg-${version}";
47− version = "1.19.0.5";
48− src = fetchurl {
49− url = "mirror://debian/pool/main/d/dpkg/dpkg_${version}.tar.xz";
50− sha256 = "1dc5kp3fqy1k66fly6jfxkkg7w6d0jy8szddpfyc2xvzga94d041";
51− };
52− });
53−
54− # filter out static linking configuration to avoid that the library will
55− # be linked both statically and dynamically.
56− gflags = gflags.overrideAttrs (old: {
57− cmakeFlags = stdenv.lib.filter (f: (builtins.match ".*STATIC.*" f) == null) old.cmakeFlags;
58− });
59− };
60−in
61−
62−stdenv.mkDerivation rec {
63− pname = "osquery";
64− version = "3.3.2";
65−
66− # this is what `osquery --help` will show as the version.
67− OSQUERY_BUILD_VERSION = version;
68− OSQUERY_PLATFORM = "NixOS;";
69−
70− src = fetchFromGitHub {
71− owner = "facebook";
72− repo = pname;
73− rev = version;
74− sha256 = "0nrwmzmbziacs3y0nljyc73bibr3w68myjpfwkicg9zgkq4qihij";
75− };
76−
77− patches = [ ./0001-Fix-CMake-configuration-for-Nix.patch ];
78−
79− NIX_CFLAGS_COMPILE = [
80− "-I${libxml2.dev}/include/libxml2"
81− ];
82−
83− nativeBuildInputs = [ python which git cscope ctags cmake pkgconfig doxygen fpm ]
84− ++ (with python.pkgs; [ jinja2 ]);
85−
86− buildInputs = [
87− udev
88− audit
89− (aws-sdk-cpp.override {
90− apis = [ "firehose" "kinesis" "sts" "ec2" ];
91− customMemoryManagement = false;
92− })
93− overrides.lvm2
94− libgcrypt
95− libarchive
96− libgpgerror
97− libuuid
98− iptables
99− overrides.dpkg
100− lzma
101− bzip2
102− rpm
103− beecrypt
104− augeas
105− libxml2
106− sleuthkit
107− yara
108− lldpd
109− overrides.gflags
110− thrift
111− boost
112− glog
113− gbenchmark
114− snappy
115− openssl
116− file
117− cryptsetup
118− gtest
119− zstd
120− rdkafka
121− rapidjson
122− rocksdb_lite
123− libelfin
124− ssdeep
125− overrides.smartmontools
126− ];
127−
128− cmakeFlags = [ "-DSKIP_TESTS=1" ];
129−
130− preConfigure = ''
131− cp -r ${fetchFromGitHub {
132− owner = "osquery";
133− repo = "third-party";
134− rev = "32e01462fbea75d3b1904693f937dfd62eaced15";
135− sha256 = "0va24gmgk43a1lyjs63q9qrhvpv8gmqjzpjr5595vhr16idv8wyf";
136− }}/* third-party
137−
138− chmod +w -R third-party
139− '';
140−
141− meta = with lib; {
142− description = "SQL powered operating system instrumentation, monitoring, and analytics";
143− homepage = https://osquery.io/;
144− license = licenses.bsd3;
145− platforms = platforms.linux;
146− maintainers = with maintainers; [ cstrahan ma27 ];
147− broken = true;
148− };
149−}