summaryrefslogtreecommitdiffstats
path: root/lass/5pkgs/newsbot-js/default.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2015-10-15 00:29:37 +0200
committermakefu <github@syntax-fehler.de>2015-10-15 00:29:37 +0200
commit5d10eff1817b0d320d5ba83cdcdfe8cc99b87b19 (patch)
tree55f63ae969c2e2332fef6a951750aef31bd9b376 /lass/5pkgs/newsbot-js/default.nix
parent51b88fc8e3ec339445af98f2416baf71d58a7077 (diff)
parent32c8e9a10b14071c5e5b128c33eaa87a363bce81 (diff)
Merge remote-tracking branch 'cd/master'
Diffstat (limited to 'lass/5pkgs/newsbot-js/default.nix')
-rw-r--r--lass/5pkgs/newsbot-js/default.nix60
1 files changed, 60 insertions, 0 deletions
diff --git a/lass/5pkgs/newsbot-js/default.nix b/lass/5pkgs/newsbot-js/default.nix
new file mode 100644
index 000000000..7758b04db
--- /dev/null
+++ b/lass/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 = "cd32ef7b39819f53c7125b22c594202724cc8754";
+ sha256 = "425e800f7638a5679ed8a049614a7533f3c8dd09659061885240dc93952ff0ae";
+ };
+
+ 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
+ '';
+
+}