depot/nixos/modules/services/networking/jotta-cli.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

40 lines
1.1 KiB
Nix

{ config, lib, pkgs, ... }:
let cfg = config.services.jotta-cli;
in {
options = {
services.jotta-cli = {
enable = lib.mkEnableOption "Jottacloud Command-line Tool";
options = lib.mkOption {
default = [ "stdoutlog" "datadir" "%h/.jottad/" ];
example = [ ];
type = with lib.types; listOf str;
description = "Command-line options passed to jottad.";
};
package = lib.mkPackageOption pkgs "jotta-cli" { };
};
};
config = lib.mkIf cfg.enable {
systemd.user.services.jottad = {
description = "Jottacloud Command-line Tool daemon";
serviceConfig = {
Type = "notify";
EnvironmentFile = "-%h/.config/jotta-cli/jotta-cli.env";
ExecStart = "${lib.getExe' cfg.package "jottad"} ${lib.concatStringsSep " " cfg.options}";
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;
}