at 24.11-pre 1.1 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let cfg = config.services.jotta-cli; 6in { 7 options = { 8 services.jotta-cli = { 9 10 enable = mkEnableOption "Jottacloud Command-line Tool"; 11 12 options = mkOption { 13 default = [ "stdoutlog" "datadir" "%h/.jottad/" ]; 14 example = [ ]; 15 type = with types; listOf str; 16 description = "Command-line options passed to jottad."; 17 }; 18 19 package = lib.mkPackageOption pkgs "jotta-cli" { }; 20 }; 21 }; 22 config = mkIf cfg.enable { 23 systemd.user.services.jottad = { 24 25 description = "Jottacloud Command-line Tool daemon"; 26 27 serviceConfig = { 28 Type = "notify"; 29 EnvironmentFile = "-%h/.config/jotta-cli/jotta-cli.env"; 30 ExecStart = "${lib.getExe' cfg.package "jottad"} ${concatStringsSep " " cfg.options}"; 31 Restart = "on-failure"; 32 }; 33 34 wantedBy = [ "default.target" ]; 35 wants = [ "network-online.target" ]; 36 after = [ "network-online.target" ]; 37 }; 38 environment.systemPackages = [ pkgs.jotta-cli ]; 39 }; 40 41 meta.maintainers = with lib.maintainers; [ evenbrenden ]; 42 meta.doc = ./jotta-cli.md; 43}