about summary refs log tree commit diff
path: root/pkgs/tools/security/prey/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/security/prey/default.nix')
-rw-r--r--pkgs/tools/security/prey/default.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/pkgs/tools/security/prey/default.nix b/pkgs/tools/security/prey/default.nix
new file mode 100644
index 000000000000..fe71806301dd
--- /dev/null
+++ b/pkgs/tools/security/prey/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, fetchgit, curl, scrot, imagemagick, xawtv, inetutils, makeWrapper, coreutils
+, apiKey ? ""
+, deviceKey ? "" }:
+
+# TODO: this should assert keys are set, somehow if set through .override assertion fails
+#assert apiKey != "";
+#assert deviceKey != "";
+
+let
+  modulesSrc = fetchgit {
+    url = "git://github.com/prey/prey-bash-client-modules.git";
+    rev = "aba260ef110834cb2e92923a31f50c15970639ee";
+  };
+in stdenv.mkDerivation rec {
+  name = "prey-bash-client-${version}";
+  version = "0.6.0";
+
+  src = fetchurl {
+    url = "https://github.com/prey/prey-bash-client/archive/v${version}.tar.gz";
+    sha256 = "09cb15jh4jdwvix9nx048ajkw2r5jaflk68y3rkha541n8n0qwh0";
+  };
+
+  buildInputs = [ curl scrot imagemagick xawtv makeWrapper ];
+
+  phases = "unpackPhase installPhase";
+
+  installPhase = ''
+    substituteInPlace config --replace api_key=\'\' "api_key='${apiKey}'"
+    substituteInPlace config --replace device_key=\'\' "device_key='${deviceKey}'"
+
+    substituteInPlace prey.sh --replace /bin/bash $(type -Pp bash)
+    mkdir -p $out/modules
+    cp -R . $out
+    cp -R ${modulesSrc}/* $out/modules/
+    wrapProgram "$out/prey.sh" \
+      --prefix PATH ":" "${xawtv}/bin:${imagemagick}/bin:${curl}/bin:${scrot}/bin:${inetutils}/bin:${coreutils}/bin" \
+      --set CURL_CA_BUNDLE "/etc/ssl/certs/ca-bundle.crt"
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://preyproject.com;
+    description = "Proven tracking software that helps you find, lock and recover your devices when stolen or missing";
+    maintainers = with maintainers; [ iElectric ];
+    license = licenses.gpl3;
+  };
+}