From cb9e63e078debba092cdfbd98ba39b4c817fb858 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 9 Oct 2015 13:55:41 +0200 Subject: lass 5: add newsbot-js --- lass/5pkgs/newsbot-js/default.nix | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 lass/5pkgs/newsbot-js/default.nix (limited to 'lass/5pkgs/newsbot-js/default.nix') 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 + ''; + +} -- cgit v1.2.3