2017-07-25 02:47:32 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub, pkgconfig, cmake, pythonPackages
|
|
|
|
, udev, audit, aws-sdk-cpp, cryptsetup, lvm2, libgcrypt, libarchive
|
2018-04-24 06:13:49 +01:00
|
|
|
, libgpgerror, libuuid, iptables, dpkg, lzma, bzip2, rpm
|
2017-07-25 02:47:32 +01:00
|
|
|
, beecrypt, augeas, libxml2, sleuthkit, yara, lldpd, google-gflags
|
2018-04-24 06:13:49 +01:00
|
|
|
, thrift, boost, rocksdb_lite, glog, gbenchmark, snappy
|
|
|
|
, openssl, file, doxygen
|
2019-02-13 09:50:28 +00:00
|
|
|
, gtest, sqlite, fpm, zstd, rdkafka, rapidjson, fetchgit, fetchurl
|
2017-07-25 02:47:32 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2018-04-24 06:13:49 +01:00
|
|
|
|
2017-07-25 02:47:32 +01:00
|
|
|
thirdparty = fetchFromGitHub {
|
|
|
|
owner = "osquery";
|
|
|
|
repo = "third-party";
|
2018-06-18 15:50:31 +01:00
|
|
|
rev = "32e01462fbea75d3b1904693f937dfd62eaced15";
|
|
|
|
sha256 = "0va24gmgk43a1lyjs63q9qrhvpv8gmqjzpjr5595vhr16idv8wyf";
|
2017-07-25 02:47:32 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "osquery-${version}";
|
2018-07-18 21:23:20 +01:00
|
|
|
version = "3.2.9";
|
2017-07-25 02:47:32 +01:00
|
|
|
|
|
|
|
# this is what `osquery --help` will show as the version.
|
|
|
|
OSQUERY_BUILD_VERSION = version;
|
2018-08-07 01:43:40 +01:00
|
|
|
OSQUERY_PLATFORM = "NixOS;";
|
2017-07-25 02:47:32 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "facebook";
|
|
|
|
repo = "osquery";
|
|
|
|
rev = version;
|
2018-07-18 21:23:20 +01:00
|
|
|
sha256 = "1fac0yj1701469qhbsp38ab2fmavm3jw6x278bf78yvxdi99ivai";
|
2017-07-25 02:47:32 +01:00
|
|
|
};
|
|
|
|
|
2018-04-24 06:13:49 +01:00
|
|
|
patches = [ ./misc.patch ];
|
2017-07-25 02:47:32 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2018-04-24 06:13:49 +01:00
|
|
|
pkgconfig cmake pythonPackages.python pythonPackages.jinja2 doxygen fpm
|
2017-07-25 02:47:32 +01:00
|
|
|
];
|
|
|
|
|
2019-01-14 22:03:50 +00:00
|
|
|
NIX_LDFLAGS = [
|
|
|
|
"-lcrypto"
|
|
|
|
];
|
|
|
|
|
2018-04-24 06:13:49 +01:00
|
|
|
buildInputs = let
|
|
|
|
gflags' = google-gflags.overrideAttrs (old: {
|
|
|
|
cmakeFlags = stdenv.lib.filter (f: isNull (builtins.match ".*STATIC.*" f)) old.cmakeFlags;
|
|
|
|
});
|
2018-12-23 22:48:08 +00:00
|
|
|
|
|
|
|
# use older `lvm2` source for osquery, the 2.03 sourcetree
|
|
|
|
# will break osquery due to the lacking header `lvm2app.h`.
|
|
|
|
#
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/51756#issuecomment-446035295
|
|
|
|
lvm2' = lvm2.overrideAttrs (old: rec {
|
|
|
|
name = "lvm2-${version}";
|
|
|
|
version = "2.02.183";
|
|
|
|
src = fetchgit {
|
|
|
|
url = "git://sourceware.org/git/lvm2.git";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "1ny3srcsxd6kj59zq1cman5myj8kzw010wbyc6mrpk4kp823r5nx";
|
|
|
|
};
|
|
|
|
});
|
2019-02-13 09:50:28 +00:00
|
|
|
|
|
|
|
# dpkg 1.19.2 dropped api in `<dpkg/dpkg-db.h>` which breaks compilation.
|
|
|
|
dpkg' = dpkg.overrideAttrs (old: rec {
|
|
|
|
name = "dpkg-${version}";
|
|
|
|
version = "1.19.0.5";
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://debian/pool/main/d/dpkg/dpkg_${version}.tar.xz";
|
|
|
|
sha256 = "1dc5kp3fqy1k66fly6jfxkkg7w6d0jy8szddpfyc2xvzga94d041";
|
|
|
|
};
|
|
|
|
});
|
2018-04-24 06:13:49 +01:00
|
|
|
in [
|
2017-07-25 02:47:32 +01:00
|
|
|
udev audit
|
|
|
|
|
|
|
|
(aws-sdk-cpp.override {
|
2018-04-24 06:13:49 +01:00
|
|
|
apis = [ "firehose" "kinesis" "sts" "ec2" ];
|
2017-07-25 02:47:32 +01:00
|
|
|
customMemoryManagement = false;
|
|
|
|
})
|
|
|
|
|
2019-02-13 09:50:28 +00:00
|
|
|
lvm2' libgcrypt libarchive libgpgerror libuuid iptables dpkg'
|
2018-04-24 06:13:49 +01:00
|
|
|
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 02:47:32 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
export NIX_CFLAGS_COMPILE="-I${libxml2.dev}/include/libxml2 $NIX_CFLAGS_COMPILE"
|
|
|
|
|
|
|
|
cmakeFlagsArray+=(
|
|
|
|
-DCMAKE_LIBRARY_PATH=${cryptsetup}/lib
|
2017-07-13 05:18:52 +01:00
|
|
|
-DCMAKE_VERBOSE_MAKEFILE=OFF
|
2017-07-25 02:47:32 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
cp -r ${thirdparty}/* third-party
|
|
|
|
chmod +w -R third-party
|
2017-07-13 05:18:52 +01:00
|
|
|
rm -r third-party/{googletest,sqlite3}
|
2017-07-25 02:47:32 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "SQL powered operating system instrumentation, monitoring, and analytics";
|
2017-08-01 21:03:30 +01:00
|
|
|
homepage = https://osquery.io/;
|
2017-07-25 02:47:32 +01:00
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.linux;
|
2018-04-24 06:13:49 +01:00
|
|
|
maintainers = with maintainers; [ cstrahan ma27 ];
|
2017-07-25 02:47:32 +01:00
|
|
|
};
|
|
|
|
}
|