2021-12-05 11:35:20 +01:00
|
|
|
{ pkgs, lib, config, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.glados;
|
|
|
|
ownerArgs = list: toString (map (id: "--owner ${id}") list);
|
|
|
|
in {
|
|
|
|
options.services.glados = {
|
|
|
|
enable = lib.mkEnableOption "GLaDOS systemd service";
|
|
|
|
|
2021-12-06 10:49:27 +01:00
|
|
|
envFile = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
description = "Path to the environment configuration";
|
|
|
|
example = "/run/secrets/my-env";
|
2021-12-05 11:35:20 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-12-05 12:05:40 +01:00
|
|
|
config = lib.mkIf cfg.enable {
|
2021-12-05 11:35:20 +01:00
|
|
|
systemd.services.glados = {
|
|
|
|
wantedBy = [ "default.target" ];
|
|
|
|
serviceConfig = {
|
2021-12-06 10:49:27 +01:00
|
|
|
ExecStart = "${pkgs.glados}/bin/glados --db $STATE_DIRECTORY/state.yml";
|
|
|
|
EnvironmentFile = "${cfg.envFile}";
|
|
|
|
Environment = "RUST_LOG=warn";
|
|
|
|
StateDirectory = "glados";
|
2021-12-05 11:35:20 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|