Unverified Commit e2f90fad authored by lewo's avatar lewo Committed by GitHub
Browse files

nixos/osquery: add `package` option (#485164)

parents 64d8fd49 c5aee3bc
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -25,17 +25,20 @@ let
        ({ config_path = conf; } // cfg.flags)
    )
  );

  osquery = cfg.package;
  osqueryi = pkgs.runCommand "osqueryi" { nativeBuildInputs = [ pkgs.makeWrapper ]; } ''
    mkdir -p $out/bin
    makeWrapper ${pkgs.osquery}/bin/osqueryi $out/bin/osqueryi \
    makeWrapper ${osquery}/bin/osqueryi $out/bin/osqueryi \
      --add-flags "--flagfile ${flagfile} --disable-database"
  '';

in
{
  options.services.osquery = {
    enable = lib.mkEnableOption "osqueryd daemon";

    package = lib.mkPackageOption pkgs "osquery" { };

    settings = lib.mkOption {
      default = { };
      description = ''
@@ -108,7 +111,7 @@ in
      ];
      description = "The osquery daemon";
      serviceConfig = {
        ExecStart = "${pkgs.osquery}/bin/osqueryd --flagfile ${flagfile}";
        ExecStart = "${osquery}/bin/osqueryd --flagfile ${flagfile}";
        PIDFile = cfg.flags.pidfile;
        LogsDirectory = lib.mkIf (cfg.flags.logger_path == "/var/log/osquery") [ "osquery" ];
        StateDirectory = lib.mkIf (cfg.flags.database_path == "/var/lib/osquery/osquery.db") [ "osquery" ];
@@ -116,7 +119,7 @@ in
      };
      wantedBy = [ "multi-user.target" ];
    };
    systemd.tmpfiles.settings."10-osquery".${dirname (cfg.flags.pidfile)}.d = {
    systemd.tmpfiles.settings."10-osquery".${dirname cfg.flags.pidfile}.d = {
      user = "root";
      group = "root";
      mode = "0755";
+10 −12
Original line number Diff line number Diff line
import ./make-test-python.nix (
  { lib, pkgs, ... }:
  { lib, ... }:

  let
    config_refresh = "10";
@@ -13,9 +13,7 @@ import ./make-test-python.nix (
      lewo
    ];

    nodes.machine =
      { config, pkgs, ... }:
      {
    nodes.machine = _: {
      services.osquery = {
        enable = true;