nixos/services.tuptime: remove with lib;
This commit is contained in:
parent
307f280e81
commit
6974870a0a
@ -1,7 +1,4 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.services.tuptime;
|
cfg = config.services.tuptime;
|
||||||
@ -10,17 +7,17 @@ in {
|
|||||||
|
|
||||||
options.services.tuptime = {
|
options.services.tuptime = {
|
||||||
|
|
||||||
enable = mkEnableOption "the total uptime service";
|
enable = lib.mkEnableOption "the total uptime service";
|
||||||
|
|
||||||
timer = {
|
timer = {
|
||||||
enable = mkOption {
|
enable = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Whether to regularly log uptime to detect bad shutdowns.";
|
description = "Whether to regularly log uptime to detect bad shutdowns.";
|
||||||
};
|
};
|
||||||
|
|
||||||
period = mkOption {
|
period = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
default = "*:0/5";
|
default = "*:0/5";
|
||||||
description = "systemd calendar event";
|
description = "systemd calendar event";
|
||||||
};
|
};
|
||||||
@ -28,7 +25,7 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.tuptime ];
|
environment.systemPackages = [ pkgs.tuptime ];
|
||||||
|
|
||||||
@ -59,7 +56,7 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
tuptime-sync = mkIf cfg.timer.enable {
|
tuptime-sync = lib.mkIf cfg.timer.enable {
|
||||||
description = "Tuptime scheduled sync service";
|
description = "Tuptime scheduled sync service";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
@ -69,7 +66,7 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
timers.tuptime-sync = mkIf cfg.timer.enable {
|
timers.tuptime-sync = lib.mkIf cfg.timer.enable {
|
||||||
description = "Tuptime scheduled sync timer";
|
description = "Tuptime scheduled sync timer";
|
||||||
# this timer should be started if the service is started
|
# this timer should be started if the service is started
|
||||||
# even if the timer was previously stopped
|
# even if the timer was previously stopped
|
||||||
@ -85,6 +82,6 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
meta.maintainers = [ maintainers.evils ];
|
meta.maintainers = [ lib.maintainers.evils ];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user