Fix module

This commit is contained in:
Malte Tammena 2021-12-09 18:03:57 +01:00
parent b933d995c4
commit 461d66a3d9

View file

@ -3,10 +3,16 @@
let let
cfg = config.services.glados; cfg = config.services.glados;
ownerArgs = list: toString (map (id: "--owner ${id}") list); ownerArgs = list: toString (map (id: "--owner ${id}") list);
enableDataCollector =
if cfg.dataCollector.enable then "--enable-data-collector" else "";
in { in {
options.services.glados = { options.services.glados = {
enable = lib.mkEnableOption "GLaDOS systemd service"; enable = lib.mkEnableOption "GLaDOS systemd service";
dataCollector.enable =
lib.mkEnableOption "Enable Minecraft -> InfluxDB data collector";
envFile = lib.mkOption { envFile = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "Path to the environment configuration"; description = "Path to the environment configuration";
@ -20,7 +26,8 @@ in {
requires = [ "network-online.target" ]; requires = [ "network-online.target" ];
after = [ "network-online.target" ]; after = [ "network-online.target" ];
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.glados}/bin/glados --db $STATE_DIRECTORY/state.yml"; ExecStart =
"${pkgs.glados}/bin/glados --state $STATE_DIRECTORY/state.yml ${enableDataCollector}";
EnvironmentFile = "${cfg.envFile}"; EnvironmentFile = "${cfg.envFile}";
Environment = "RUST_LOG=warn"; Environment = "RUST_LOG=warn";
StateDirectory = "glados"; StateDirectory = "glados";