1 { config, lib, pkgs, ... }:
2 let cfg = config.services.jotta-cli;
7 enable = lib.mkEnableOption "Jottacloud Command-line Tool";
9 options = lib.mkOption {
10 default = [ "stdoutlog" "datadir" "%h/.jottad/" ];
12 type = with lib.types; listOf str;
13 description = "Command-line options passed to jottad.";
16 package = lib.mkPackageOption pkgs "jotta-cli" { };
19 config = lib.mkIf cfg.enable {
20 systemd.user.services.jottad = {
22 description = "Jottacloud Command-line Tool daemon";
26 EnvironmentFile = "-%h/.config/jotta-cli/jotta-cli.env";
27 ExecStart = "${lib.getExe' cfg.package "jottad"} ${lib.concatStringsSep " " cfg.options}";
28 Restart = "on-failure";
31 wantedBy = [ "default.target" ];
32 wants = [ "network-online.target" ];
33 after = [ "network-online.target" ];
35 environment.systemPackages = [ pkgs.jotta-cli ];
38 meta.maintainers = with lib.maintainers; [ evenbrenden ];
39 meta.doc = ./jotta-cli.md;