mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-11 15:34:05 +00:00
nixos/services.osquery: remove with lib;
This commit is contained in:
parent
f88528a137
commit
500c84cedd
@ -1,6 +1,4 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.osquery;
|
||||
dirname = path: with lib.strings; with lib.lists; concatStringsSep "/"
|
||||
@ -13,8 +11,8 @@ let
|
||||
# flagfile is the file containing osquery command line flags to be
|
||||
# provided to the application using the special --flagfile option.
|
||||
flagfile = pkgs.writeText "osquery.flags"
|
||||
(concatStringsSep "\n"
|
||||
(mapAttrsToList (name: value: "--${name}=${value}")
|
||||
(lib.concatStringsSep "\n"
|
||||
(lib.mapAttrsToList (name: value: "--${name}=${value}")
|
||||
# Use the conf derivation if not otherwise specified.
|
||||
({ config_path = conf; } // cfg.flags)));
|
||||
|
||||
@ -26,9 +24,9 @@ let
|
||||
in
|
||||
{
|
||||
options.services.osquery = {
|
||||
enable = mkEnableOption "osqueryd daemon";
|
||||
enable = lib.mkEnableOption "osqueryd daemon";
|
||||
|
||||
settings = mkOption {
|
||||
settings = lib.mkOption {
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration to be written to the osqueryd JSON configuration file.
|
||||
@ -37,10 +35,10 @@ in
|
||||
example = {
|
||||
options.utc = false;
|
||||
};
|
||||
type = types.attrs;
|
||||
type = lib.types.attrs;
|
||||
};
|
||||
|
||||
flags = mkOption {
|
||||
flags = lib.mkOption {
|
||||
default = { };
|
||||
description = ''
|
||||
Attribute set of flag names and values to be written to the osqueryd flagfile.
|
||||
@ -49,23 +47,23 @@ in
|
||||
example = {
|
||||
config_refresh = "10";
|
||||
};
|
||||
type = with types;
|
||||
type = with lib.types;
|
||||
submodule {
|
||||
freeformType = attrsOf str;
|
||||
options = {
|
||||
database_path = mkOption {
|
||||
database_path = lib.mkOption {
|
||||
default = "/var/lib/osquery/osquery.db";
|
||||
readOnly = true;
|
||||
description = "Path used for the database file.";
|
||||
type = path;
|
||||
};
|
||||
logger_path = mkOption {
|
||||
logger_path = lib.mkOption {
|
||||
default = "/var/log/osquery";
|
||||
readOnly = true;
|
||||
description = "Base directory used for logging.";
|
||||
type = path;
|
||||
};
|
||||
pidfile = mkOption {
|
||||
pidfile = lib.mkOption {
|
||||
default = "/run/osquery/osqueryd.pid";
|
||||
readOnly = true;
|
||||
description = "Path used for pid file.";
|
||||
@ -76,7 +74,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ osqueryi ];
|
||||
systemd.services.osqueryd = {
|
||||
after = [ "network.target" "syslog.service" ];
|
||||
|
Loading…
Reference in New Issue
Block a user