stub service

This commit is contained in:
Alex Tau 2025-04-28 20:04:04 +03:00
parent 19984b43f4
commit f158bc3778
6 changed files with 92 additions and 52 deletions

View file

@ -1,14 +1,42 @@
package:
{
config,
lib,
pkgs,
...
}:
{
options.services.lego-monitoring = {
enable = lib.mkEnableOption "lego-monitoring service.";
nonSecretConfigOption = lib.mkOption {
type = lib.types.str;
default = "defaultValue";
description = "An example non-secret config option.";
};
configOptionSecretPath = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = "Path to an example secret config option.";
};
};
config = {};
config = let
cfg = config.services.lego-monitoring;
json = pkgs.formats.json {};
serviceConfigFile = json.generate "config.json" {
non_secret_config_option = cfg.nonSecretConfigOption;
config_option_secret_path = cfg.configOptionSecretPath;
};
in lib.mkIf cfg.enable {
systemd.services.lego-monitoring = {
name = "lego-monitoring.service";
description = "Lego-monitoring service";
script = "${package}/bin/service -c ${serviceConfigFile}";
wantedBy = [ "multi-user.target" ];
};
};
}