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 http://preyproject.com/ bash client. Be sure to specify api and device keys.
20 Once setup, cronjob will run evert 15 minutes and report status.
21 '';
22 };
23
24 deviceKey = mkOption {
25 type = types.string;
26 description = "Device Key obtained from https://panel.preyproject.com/devices (and clicking on the device)";
27 };
28
29 apiKey = mkOption {
30 type = types.string;
31 description = "API key obtained from https://panel.preyproject.com/profile";
32 };
33 };
34
35 };
36
37 config = mkIf cfg.enable {
38 environment.systemPackages = [ myPrey ];
39 services.cron.systemCronJobs = [ "*/15 * * * * root ${myPrey}/prey.sh" ];
40 };
41
42}