1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 7 cfg = config.services.copy-com; 8 9in 10 11{ 12 options = { 13 14 services.copy-com = { 15 16 enable = mkOption { 17 default = false; 18 description = " 19 Enable the Copy.com client. 20 NOTE: before enabling the client for the first time, it must be 21 configured by first running CopyConsole (command line) or CopyAgent 22 (graphical) as the appropriate user. 23 "; 24 }; 25 26 user = mkOption { 27 description = "The user for which the Copy.com client should be run."; 28 }; 29 30 debug = mkOption { 31 default = false; 32 description = "Output more (debugging) messages to the console."; 33 }; 34 }; 35 }; 36 37 config = mkIf cfg.enable { 38 environment.systemPackages = [ pkgs.postfix ]; 39 40 systemd.services."copy-com-${cfg.user}" = { 41 description = "Copy.com client"; 42 wants = [ "network-online.target" ]; 43 after = [ "network-online.target" "local-fs.target" ]; 44 wantedBy = [ "multi-user.target" ]; 45 serviceConfig = { 46 ExecStart = "${pkgs.copy-com}/bin/CopyConsole ${if cfg.debug then "-consoleOutput -debugToConsole=dirwatch,path-watch,csm_path,csm -debug -console" else ""}"; 47 User = "${cfg.user}"; 48 }; 49 50 }; 51 }; 52 53} 54