Skip to content

Instantly share code, notes, and snippets.

@jbedo
Created January 15, 2014 06:44
Show Gist options
  • Save jbedo/8431881 to your computer and use it in GitHub Desktop.
Save jbedo/8431881 to your computer and use it in GitHub Desktop.
Nix expression for twister (including twister-html). To run twister, install the expression, execute "twisterd -daemon", then go to http://127.0.0.1:28332/index.html.
{ stdenv, fetchgit, boost, openssl, db48, miniupnpc, autoconf, automake, libtool, pkgconfig, zlib, makeWrapper }:
stdenv.mkDerivation rec {
name = "twister-git";
src = fetchgit {
url = "https://github.com/miguelfreitas/twister-core";
};
html = fetchgit {
url = "https://github.com/miguelfreitas/twister-html";
};
buildPhase = ''
cd libtorrent
./bootstrap.sh --with-boost-libdir=${boost}/lib
./configure --with-boost-libdir=${boost}/lib --enable-logging --enable-debug --enable-dht
make -j$NIX_BUILD_CORES
cd ../src
make -f makefile.unix -j$NIX_BUILD_CORES
'';
installPhase = ''
ensureDir $out/bin
cp twisterd $out/bin
ensureDir $out/share/html
cp -r $html/* $out/share/html
'';
postFixup = ''
wrapProgram $out/bin/twisterd \
--add-flags "-htmldir=$out/share/html" \
--add-flags "-rpcuser=user" \
--add-flags "-rpcpassword=pwd" \
--add-flags "-rpcallowip=127.0.0.1" \
'';
buildInputs = [ boost openssl db48 miniupnpc autoconf automake libtool pkgconfig zlib makeWrapper ] ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment