summary refs log tree commit diff
path: root/nixos/modules/services/networking/copy-com.nix
blob: 36bd29109b8acfe74ea200ed8fec9d4bcc451fd7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ config, lib, pkgs, ... }:

with lib;

let
  
  cfg = config.services.copy-com;

in 

{
  options = {

    services.copy-com = {
	  
	  enable = mkOption {
          default = false;
          description = "
            Enable the copy.com client.

            The first time copy.com is run, it needs to be configured. Before enabling run 
            copy_console manually.
          ";
      };

      user = mkOption {
        description = "The user for which copy should run.";
      };

      debug = mkOption {
        default = false;
        description = "Output more.";
      };
	  };
  };

  config = mkIf cfg.enable {
    environment.systemPackages = [ pkgs.postfix ];

    systemd.services."copy-com-${cfg.user}" = {
      description = "Copy.com Client";
      after = [ "network.target" "local-fs.target" ];
      wantedBy = [ "multi-user.target" ];
      serviceConfig = {
        ExecStart = "${pkgs.copy-com}/bin/copy_console ${if cfg.debug then "-consoleOutput -debugToConsole=dirwatch,path-watch,csm_path,csm -debug -console" else ""}";
        User = "${cfg.user}";
      };

    };
  };

}