about summary refs log tree commit diff
path: root/nixos/modules/security/prey.nix
blob: 75b95d5fbb04fd9629a1749e09d51bf26125ac38 (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
{config, pkgs, ...}:

with pkgs.lib;

let
  cfg = config.services.prey;
  myPrey = pkgs."prey-bash-client".override {
    apiKey = cfg.apiKey;
    deviceKey = cfg.deviceKey;
  };
in {
  options = {

    services.prey = {
      enable = mkOption {
        default = false;
        type = types.bool;
        description = ''
          Enables http://preyproject.com/ bash client. Be sure to specify api and device keys.
          Once setup, cronjob will run evert 15 minutes and report status.
        '';
      };

      deviceKey = mkOption {
        type = types.string;
        description = "Device Key obtained from https://panel.preyproject.com/devices (and clicking on the device)";
      };

      apiKey = mkOption {
        type = types.string;
        description = "API key obtained from https://panel.preyproject.com/profile";
      };
    };

  };

  config = mkIf cfg.enable {
      environment.systemPackages = [ myPrey ];
      services.cron.systemCronJobs = [ "*/15 * * * * root ${myPrey}/prey.sh" ];
  };

}