forked from the-distro/infra
raito
db46b01ae9
Vendored for the time being. See https://cl.forkos.org/c/nixpkgs/+/181 for upstreaming properly. Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
37 lines
1.1 KiB
Nix
37 lines
1.1 KiB
Nix
{ pkgs, lib, config, ... }:
|
|
let
|
|
inherit (lib) mkEnableOption mkPackageOption mkOption types mkIf;
|
|
settingsFormatYaml = pkgs.formats.yaml { };
|
|
cfg = config.services.pyroscope;
|
|
configFile = settingsFormatYaml.generate "settings.yaml" cfg.settings;
|
|
in
|
|
{
|
|
options.services.pyroscope = {
|
|
enable = mkEnableOption "pyroscope, a continuous profiling platform";
|
|
package = mkPackageOption pkgs "pyroscope" { };
|
|
settings = mkOption {
|
|
description = "Pyroscope settings. See <>";
|
|
|
|
type = types.submodule {
|
|
freeformType = settingsFormatYaml.type;
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
systemd.services.pyroscope = {
|
|
description = "Pyroscope server - a continuous profiling platform";
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
ExecStart = "${cfg.package}/bin/pyroscope -config.file ${configFile}";
|
|
WorkingDirectory = "/var/lib/pyroscope";
|
|
User = "pyroscope";
|
|
DynamicUser = true;
|
|
Restart = "on-failure";
|
|
RuntimeDirectory = "pyroscope";
|
|
StateDirectory = "pyroscope";
|
|
};
|
|
};
|
|
};
|
|
}
|