summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/newsbot-js/default.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-05-24 01:43:50 +0200
committertv <tv@krebsco.de>2017-05-24 01:43:50 +0200
commitf0b98bd0114df1e1ebb82ff300f9532d86b3eb18 (patch)
tree58a39173f7d6d7caa10a7b8fec1b5a1e54f0c08c /krebs/5pkgs/simple/newsbot-js/default.nix
parent46d6506916f699e3b707dc41cd68c92b98e50e5a (diff)
krebs/5pkgs: move simple pkgs to a subdir
Diffstat (limited to 'krebs/5pkgs/simple/newsbot-js/default.nix')
-rw-r--r--krebs/5pkgs/simple/newsbot-js/default.nix60
1 files changed, 60 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/newsbot-js/default.nix b/krebs/5pkgs/simple/newsbot-js/default.nix
new file mode 100644
index 000000000..b52454ca4
--- /dev/null
+++ b/krebs/5pkgs/simple/newsbot-js/default.nix
@@ -0,0 +1,60 @@
+{ stdenv, makeWrapper, callPackage, lib, buildEnv, fetchgit, nodePackages, nodejs }:
+
+with lib;
+
+let
+ np = (callPackage <nixpkgs/pkgs/top-level/node-packages.nix>) {
+ 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 np.buildNodePackage {
+ name = "newsbot-js";
+
+ src = fetchgit {
+ url = "http://cgit.prism/newsbot-js/";
+ rev = "09e01639be4ea9691cf5b33f7d9057b68ac98079";
+ sha256 = "28ffbed66c2efcd194c47823c7d5d5533c80852fc0cf9d9d4ee609c71d50c142";
+ };
+
+ 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
+ '';
+
+}