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

with 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 the <link xlink:href="http://preyproject.com/" />
          shell client. Be sure to specify both API and device keys.
          Once enabled, a <command>cron</command> job will run every 15
          minutes to report status information.
        '';
      };

      deviceKey = mkOption {
        type = types.str;
        description = ''
          <literal>Device key</literal> obtained by visiting
          <link xlink:href="https://panel.preyproject.com/devices" />
          and clicking on your device.
        '';
      };

      apiKey = mkOption {
        type = types.str;
        description = ''
          <literal>API key</literal> obtained from
          <link xlink:href="https://panel.preyproject.com/profile" />.
        '';
      };
    };

  };

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

}