2017-07-25 03:47:32 +02:00
|
|
|
{ stdenv, lib, fetchFromGitHub, pkgconfig, cmake, pythonPackages
|
|
|
|
, udev, audit, aws-sdk-cpp, cryptsetup, lvm2, libgcrypt, libarchive
|
2018-04-24 07:13:49 +02:00
|
|
|
, libgpgerror, libuuid, iptables, dpkg, lzma, bzip2, rpm
|
2017-07-25 03:47:32 +02:00
|
|
|
, beecrypt, augeas, libxml2, sleuthkit, yara, lldpd, google-gflags
|
2018-04-24 07:13:49 +02:00
|
|
|
, thrift, boost, rocksdb_lite, glog, gbenchmark, snappy
|
|
|
|
, openssl, file, doxygen
|
|
|
|
, gtest, sqlite, fpm, zstd, rdkafka, rapidjson, path
|
2017-07-25 03:47:32 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2018-04-24 07:13:49 +02:00
|
|
|
|
2017-07-25 03:47:32 +02:00
|
|
|
thirdparty = fetchFromGitHub {
|
|
|
|
owner = "osquery";
|
|
|
|
repo = "third-party";
|
2018-04-24 07:13:49 +02:00
|
|
|
rev = "4ef099c31a1165c5e7e3a699f9e4b3eb68c3c3d9";
|
|
|
|
sha256 = "1vm0prw4dix0m51vkw9z0vwfd8698gqjw499q8h604hs1rvn6132";
|
2017-07-25 03:47:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "osquery-${version}";
|
2018-04-24 07:13:49 +02:00
|
|
|
version = "3.2.2";
|
2017-07-25 03:47:32 +02:00
|
|
|
|
|
|
|
# this is what `osquery --help` will show as the version.
|
|
|
|
OSQUERY_BUILD_VERSION = version;
|
2018-04-26 10:31:05 +02:00
|
|
|
OSQUERY_PLATFORM = "nixos;${stdenv.lib.version}";
|
2017-07-25 03:47:32 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "facebook";
|
|
|
|
repo = "osquery";
|
|
|
|
rev = version;
|
2018-04-24 07:13:49 +02:00
|
|
|
sha256 = "0qwj4cy6m25sqwb0irqfqinipx50l4imnz1gqxx147vzfwb52jlq";
|
2017-07-25 03:47:32 +02:00
|
|
|
};
|
|
|
|
|
2018-04-24 07:13:49 +02:00
|
|
|
patches = [ ./misc.patch ];
|
2017-07-25 03:47:32 +02:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2018-04-24 07:13:49 +02:00
|
|
|
pkgconfig cmake pythonPackages.python pythonPackages.jinja2 doxygen fpm
|
2017-07-25 03:47:32 +02:00
|
|
|
];
|
|
|
|
|
2018-04-24 07:13:49 +02:00
|
|
|
buildInputs = let
|
|
|
|
gflags' = google-gflags.overrideAttrs (old: {
|
|
|
|
cmakeFlags = stdenv.lib.filter (f: isNull (builtins.match ".*STATIC.*" f)) old.cmakeFlags;
|
|
|
|
});
|
|
|
|
in [
|
2017-07-25 03:47:32 +02:00
|
|
|
udev audit
|
|
|
|
|
|
|
|
(aws-sdk-cpp.override {
|
2018-04-24 07:13:49 +02:00
|
|
|
apis = [ "firehose" "kinesis" "sts" "ec2" ];
|
2017-07-25 03:47:32 +02:00
|
|
|
customMemoryManagement = false;
|
|
|
|
})
|
|
|
|
|
2018-04-24 07:13:49 +02:00
|
|
|
lvm2 libgcrypt libarchive libgpgerror libuuid iptables dpkg
|
|
|
|
lzma bzip2 rpm beecrypt augeas libxml2 sleuthkit
|
|
|
|
yara lldpd gflags' thrift boost
|
|
|
|
glog gbenchmark snappy openssl
|
|
|
|
file cryptsetup
|
|
|
|
gtest sqlite zstd rdkafka rapidjson rocksdb_lite
|
2017-07-25 03:47:32 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
export NIX_CFLAGS_COMPILE="-I${libxml2.dev}/include/libxml2 $NIX_CFLAGS_COMPILE"
|
|
|
|
|
|
|
|
cmakeFlagsArray+=(
|
|
|
|
-DCMAKE_LIBRARY_PATH=${cryptsetup}/lib
|
2017-07-13 06:18:52 +02:00
|
|
|
-DCMAKE_VERBOSE_MAKEFILE=OFF
|
2017-07-25 03:47:32 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
cp -r ${thirdparty}/* third-party
|
|
|
|
chmod +w -R third-party
|
2017-07-13 06:18:52 +02:00
|
|
|
rm -r third-party/{googletest,sqlite3}
|
2017-07-25 03:47:32 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "SQL powered operating system instrumentation, monitoring, and analytics";
|
2017-08-01 22:03:30 +02:00
|
|
|
homepage = https://osquery.io/;
|
2017-07-25 03:47:32 +02:00
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.linux;
|
2018-04-24 07:13:49 +02:00
|
|
|
maintainers = with maintainers; [ cstrahan ma27 ];
|
2017-07-25 03:47:32 +02:00
|
|
|
};
|
|
|
|
}
|