Add a proper shell.nix
This commit is contained in:
parent
e6a04ff71c
commit
7a9caf3d70
@ -1,12 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# This script uses nix-shell to build an environment suitable for developing and testing this package
|
|
||||||
|
|
||||||
# Run this with the "start" argument to automatically download deps and
|
|
||||||
# start talking to asjon in the CLI :)
|
|
||||||
|
|
||||||
if [ "$1" == "start" ]; then
|
|
||||||
nix-shell -p gnumake python2 nodejs --command "npm install && bin/hubot"
|
|
||||||
else
|
|
||||||
nix-shell -p gnumake python2 nodejs
|
|
||||||
fi
|
|
47
shell.nix
Normal file
47
shell.nix
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> {}, mode ? "shell" }:
|
||||||
|
|
||||||
|
with pkgs.lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
modes = {
|
||||||
|
shell = "exec zsh";
|
||||||
|
test = "npm test";
|
||||||
|
run = "exec bin/hubot";
|
||||||
|
runTg = ''
|
||||||
|
telegram-cli \
|
||||||
|
-dWE \
|
||||||
|
-Z $HUBOT_TG_SCRIPT \
|
||||||
|
-P $HUBOT_TG_PORT > /dev/null 2>&1 &
|
||||||
|
bin/hubot -a tg
|
||||||
|
pkill -9 telegram-wo-key; exit
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
telegram = pkgs.telegram-cli.override {
|
||||||
|
python = pkgs.python3;
|
||||||
|
};
|
||||||
|
|
||||||
|
in pkgs.stdenv.mkDerivation rec {
|
||||||
|
name = "asjon-dev";
|
||||||
|
source = ".";
|
||||||
|
|
||||||
|
buildInputs = node ++ external;
|
||||||
|
node = with pkgs.nodePackages; [
|
||||||
|
pkgs.nodejs
|
||||||
|
mocha
|
||||||
|
coffee-script
|
||||||
|
];
|
||||||
|
external = with pkgs; [
|
||||||
|
zsh
|
||||||
|
telegram
|
||||||
|
graphicsmagick
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = environment + getAttr mode modes;
|
||||||
|
environment = ''
|
||||||
|
#set env variables here
|
||||||
|
export HUBOT_TG_SCRIPT=node_modules/hubot-tg/hubot.py
|
||||||
|
export HUBOT_TG_PORT=1123
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user