mirror of
https://github.com/nix-community/home-manager
synced 2024-12-25 11:19:47 +01:00
atuin: make daemon log level configurable
This commit is contained in:
parent
f8bc330a13
commit
dfdf59b2d5
1 changed files with 20 additions and 4 deletions
|
@ -5,6 +5,7 @@ with lib;
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.programs.atuin;
|
cfg = config.programs.atuin;
|
||||||
|
daemonCfg = cfg.daemon;
|
||||||
|
|
||||||
tomlFormat = pkgs.formats.toml { };
|
tomlFormat = pkgs.formats.toml { };
|
||||||
|
|
||||||
|
@ -96,7 +97,18 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
daemon.enable = mkEnableOption "atuin daemon";
|
daemon = {
|
||||||
|
enable = mkEnableOption "Atuin daemon";
|
||||||
|
|
||||||
|
logLevel = mkOption {
|
||||||
|
default = null;
|
||||||
|
type =
|
||||||
|
types.nullOr (types.enum [ "trace" "debug" "info" "warn" "error" ]);
|
||||||
|
description = ''
|
||||||
|
Verbosity of Atuin daemon logging.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let flagsStr = escapeShellArgs cfg.flags;
|
config = let flagsStr = escapeShellArgs cfg.flags;
|
||||||
|
@ -143,7 +155,7 @@ in {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
(mkIf cfg.daemon.enable (mkMerge [
|
(mkIf daemonCfg.enable (mkMerge [
|
||||||
{
|
{
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
|
@ -175,7 +187,8 @@ in {
|
||||||
};
|
};
|
||||||
Service = {
|
Service = {
|
||||||
ExecStart = "${lib.getExe cfg.package} daemon";
|
ExecStart = "${lib.getExe cfg.package} daemon";
|
||||||
Environment = [ "ATUIN_LOG=info" ];
|
Environment = lib.optionals (daemonCfg.logLevel != null)
|
||||||
|
[ "ATUIN_LOG=${daemonCfg.logLevel}" ];
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSteps = 3;
|
RestartSteps = 3;
|
||||||
RestartMaxDelaySec = 6;
|
RestartMaxDelaySec = 6;
|
||||||
|
@ -197,7 +210,10 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = {
|
config = {
|
||||||
ProgramArguments = [ "${lib.getExe cfg.package}" "daemon" ];
|
ProgramArguments = [ "${lib.getExe cfg.package}" "daemon" ];
|
||||||
EnvironmentVariables = { ATUIN_LOG = "info"; };
|
EnvironmentVariables =
|
||||||
|
lib.optionalAttrs (daemonCfg.logLevel != null) {
|
||||||
|
ATUIN_LOG = daemonCfg.logLevel;
|
||||||
|
};
|
||||||
KeepAlive = {
|
KeepAlive = {
|
||||||
Crashed = true;
|
Crashed = true;
|
||||||
SuccessfulExit = false;
|
SuccessfulExit = false;
|
||||||
|
|
Loading…
Reference in a new issue