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