{ 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 
          shell client. Be sure to specify both API and device keys.
          Once enabled, a cron job will run every 15
          minutes to report status information.
        '';
      };
      deviceKey = mkOption {
        type = types.str;
        description = ''
          Device key obtained by visiting
          
          and clicking on your device.
        '';
      };
      apiKey = mkOption {
        type = types.str;
        description = ''
          API key obtained from
          .
        '';
      };
    };
  };
  config = mkIf cfg.enable {
      environment.systemPackages = [ myPrey ];
      services.cron.systemCronJobs = [ "*/15 * * * * root ${myPrey}/prey.sh" ];
  };
}