2024-04-06 08:02:46 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2024-05-05 17:25:40 +00:00
|
|
|
let cfg = config.services.jotta-cli;
|
2024-04-06 08:02:46 +00:00
|
|
|
in {
|
|
|
|
options = {
|
2024-05-05 17:25:40 +00:00
|
|
|
services.jotta-cli = {
|
2024-04-06 08:02:46 +00:00
|
|
|
|
2024-08-28 19:19:11 +00:00
|
|
|
enable = lib.mkEnableOption "Jottacloud Command-line Tool";
|
2024-04-06 08:02:46 +00:00
|
|
|
|
2024-08-28 19:19:11 +00:00
|
|
|
options = lib.mkOption {
|
2024-04-06 08:02:46 +00:00
|
|
|
default = [ "stdoutlog" "datadir" "%h/.jottad/" ];
|
|
|
|
example = [ ];
|
2024-08-28 19:19:11 +00:00
|
|
|
type = with lib.types; listOf str;
|
2024-04-06 08:02:46 +00:00
|
|
|
description = "Command-line options passed to jottad.";
|
|
|
|
};
|
|
|
|
|
|
|
|
package = lib.mkPackageOption pkgs "jotta-cli" { };
|
|
|
|
};
|
|
|
|
};
|
2024-08-28 19:19:11 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
2024-04-06 08:02:46 +00:00
|
|
|
systemd.user.services.jottad = {
|
|
|
|
|
|
|
|
description = "Jottacloud Command-line Tool daemon";
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "notify";
|
|
|
|
EnvironmentFile = "-%h/.config/jotta-cli/jotta-cli.env";
|
2024-08-28 19:19:11 +00:00
|
|
|
ExecStart = "${lib.getExe' cfg.package "jottad"} ${lib.concatStringsSep " " cfg.options}";
|
2024-04-06 08:02:46 +00:00
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
|
|
|
|
wantedBy = [ "default.target" ];
|
|
|
|
wants = [ "network-online.target" ];
|
|
|
|
after = [ "network-online.target" ];
|
|
|
|
};
|
|
|
|
environment.systemPackages = [ pkgs.jotta-cli ];
|
|
|
|
};
|
|
|
|
|
|
|
|
meta.maintainers = with lib.maintainers; [ evenbrenden ];
|
|
|
|
meta.doc = ./jotta-cli.md;
|
|
|
|
}
|