summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/newsbot-js/default.nix
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2016-03-15 14:26:51 +0100
committerlassulus <lass@aidsballs.de>2016-03-15 14:26:51 +0100
commit5a3c98aec7ff1755daa4b9cc647c2bbe0b8ba036 (patch)
tree5e9ff717f95df03f8923bdee9ab5b7f536cf9f49 /krebs/5pkgs/newsbot-js/default.nix
parent72939a2d6f45950dbfa6ec0815eae62e83d02630 (diff)
l 5 newsbot-js -> k 5 newsbot-js
Diffstat (limited to 'krebs/5pkgs/newsbot-js/default.nix')
-rw-r--r--krebs/5pkgs/newsbot-js/default.nix60
1 files changed, 60 insertions, 0 deletions
diff --git a/krebs/5pkgs/newsbot-js/default.nix b/krebs/5pkgs/newsbot-js/default.nix
new file mode 100644
index 000000000..cabd7422c
--- /dev/null
+++ b/krebs/5pkgs/newsbot-js/default.nix
@@ -0,0 +1,60 @@
+{ stdenv, makeWrapper, lib, buildEnv, fetchgit, nodePackages, nodejs }:
+
+with lib;
+
+let
+ np = nodePackages.override {
+ generated = ./packages.nix;
+ self = np;
+ };
+
+ node_env = buildEnv {
+ name = "node_env";
+ paths = [
+ np.feedparser
+ np.form-data
+ np.irc
+ np.request
+ np.shell-quote
+ ];
+ pathsToLink = [ "/lib" ];
+ ignoreCollisions = true;
+ };
+
+in nodePackages.buildNodePackage {
+ name = "newsbot-js";
+
+ src = fetchgit {
+ url = "http://cgit.echelon/newsbot-js/";
+ rev = "802b172d0eed6c9625a9cb5db408f5cc8c01784e";
+ sha256 = "794fc7845aca311f7cf7b6bdc109b5a25d0e2299322bc6612edadc477b2536e2";
+ };
+
+ phases = [
+ "unpackPhase"
+ "installPhase"
+ ];
+
+ deps = (filter (v: nixType v == "derivation") (attrValues np));
+
+ buildInputs = [
+ nodejs
+ makeWrapper
+ ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+
+ cp newsbot.js $out/
+ cat > $out/newsbot << EOF
+ ${nodejs}/bin/node $out/newsbot.js
+ EOF
+ chmod +x $out/newsbot
+
+ wrapProgram $out/newsbot \
+ --prefix NODE_PATH : ${node_env}/lib/node_modules
+
+ ln -s $out/newsbot /$out/bin/newsbot
+ '';
+
+}