nixos/services.litestream: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-28 21:18:58 +02:00 committed by Jörg Thalheim
parent 8f72002794
commit 6bf4d51606

View File

@ -1,18 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.litestream;
settingsFormat = pkgs.formats.yaml {};
in
{
options.services.litestream = {
enable = mkEnableOption "litestream";
enable = lib.mkEnableOption "litestream";
package = mkPackageOption pkgs "litestream" { };
package = lib.mkPackageOption pkgs "litestream" { };
settings = mkOption {
settings = lib.mkOption {
description = ''
See the [documentation](https://litestream.io/reference/config/).
'';
@ -31,8 +28,8 @@ in
};
};
environmentFile = mkOption {
type = types.nullOr types.path;
environmentFile = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
example = "/run/secrets/litestream";
description = ''
@ -61,7 +58,7 @@ in
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
environment.etc = {
"litestream.yml" = {
@ -74,7 +71,7 @@ in
wantedBy = [ "multi-user.target" ];
after = [ "networking.target" ];
serviceConfig = {
EnvironmentFile = mkIf (cfg.environmentFile != null) cfg.environmentFile;
EnvironmentFile = lib.mkIf (cfg.environmentFile != null) cfg.environmentFile;
ExecStart = "${cfg.package}/bin/litestream replicate";
Restart = "always";
User = "litestream";