···6363 freeformType = attrsOf str;
6464 options = {
6565 database_path = lib.mkOption {
6666- default = "osquery/osquery.db";
6666+ default = "/var/lib/osquery/osquery.db";
6767 readOnly = true;
6868- description = "Path used for the database file, relative to /var/lib/.";
6969- type = nonEmptyStr;
6868+ description = ''
6969+ Path used for the database file.
7070+7171+ ::: {.note}
7272+ If left as the default value, this directory will be automatically created before the
7373+ service starts, otherwise you are responsible for ensuring the directory exists with
7474+ the appropriate ownership and permissions.
7575+ '';
7676+ type = path;
7077 };
7178 logger_path = lib.mkOption {
7272- default = "osquery";
7979+ default = "/var/log/osquery";
7380 readOnly = true;
7474- description = "Base directory used for logging, relative to /var/log/.";
7575- type = nonEmptyStr;
8181+ description = ''
8282+ Base directory used for logging.
8383+8484+ ::: {.note}
8585+ If left as the default value, this directory will be automatically created before the
8686+ service starts, otherwise you are responsible for ensuring the directory exists with
8787+ the appropriate ownership and permissions.
8888+ '';
8989+ type = path;
7690 };
7791 pidfile = lib.mkOption {
7892 default = "/run/osquery/osqueryd.pid";
···96110 serviceConfig = {
97111 ExecStart = "${pkgs.osquery}/bin/osqueryd --flagfile ${flagfile}";
98112 PIDFile = cfg.flags.pidfile;
9999- LogsDirectory = cfg.flags.logger_path;
100100- StateDirectory = dirname cfg.flags.database_path;
113113+ LogsDirectory = lib.mkIf (cfg.flags.logger_path == "/var/log/osquery") [ "osquery" ];
114114+ StateDirectory = lib.mkIf (cfg.flags.database_path == "/var/lib/osquery/osquery.db") [ "osquery" ];
101115 Restart = "always";
102116 };
103117 wantedBy = [ "multi-user.target" ];