1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 cfg = config.services.prey;
7 myPrey = pkgs."prey-bash-client".override {
8 apiKey = cfg.apiKey;
9 deviceKey = cfg.deviceKey;
10 };
11in {
12 options = {
13
14 services.prey = {
15 enable = mkOption {
16 default = false;
17 type = types.bool;
18 description = ''
19 Enables the <link xlink:href="http://preyproject.com/" />
20 shell client. Be sure to specify both API and device keys.
21 Once enabled, a <command>cron</command> job will run every 15
22 minutes to report status information.
23 '';
24 };
25
26 deviceKey = mkOption {
27 type = types.str;
28 description = ''
29 <literal>Device key</literal> obtained by visiting
30 <link xlink:href="https://panel.preyproject.com/devices" />
31 and clicking on your device.
32 '';
33 };
34
35 apiKey = mkOption {
36 type = types.str;
37 description = ''
38 <literal>API key</literal> obtained from
39 <link xlink:href="https://panel.preyproject.com/profile" />.
40 '';
41 };
42 };
43
44 };
45
46 config = mkIf cfg.enable {
47 environment.systemPackages = [ myPrey ];
48 services.cron.systemCronJobs = [ "*/15 * * * * root ${myPrey}/prey.sh" ];
49 };
50
51}