Altcoins - a new category of applications

Here, I present a new level of hierarchy on Nixpkgs: the Altcoins.

The idea is to put a single cryptocurrency per file, and build them
using expressions like altcoins.bitcoin. I believe this ordering is
clearer and more maintainable that the current one.
This commit is contained in:
AndersonTorres 2014-11-30 11:13:47 -02:00
parent 8281ef1231
commit ac4f15b282
15 changed files with 247 additions and 357 deletions

View File

@ -0,0 +1,36 @@
{ stdenv, fetchurl, pkgconfig, autoreconfHook, openssl, db48, boost
, zlib, miniupnpc, qt4, utillinux, protobuf, qrencode
, withGui }:
with stdenv.lib;
stdenv.mkDerivation rec{
name = "bitcoin" + (toString (optional (!withGui) "d")) + "-" + version;
version = "0.9.3";
src = fetchurl {
url = "https://github.com/bitcoin/bitcoin/archive/v${version}.tar.gz";
sha256 = "0a6lkfzsmqqcbz2cc0cg8dccd990b5y7qi8mw358fhfb4f1jxn9y";
};
buildInputs = [ pkgconfig autoreconfHook openssl db48 boost zlib
miniupnpc utillinux protobuf ]
++ optionals withGui [ qt4 qrencode ];
configureFlags = [ "--with-boost-libdir=${boost.lib}/lib" ]
++ optionals withGui [ "--with-gui=qt4" ];
meta = {
description = "Peer-to-peer electronic cash system";
longDescription= ''
Bitcoin is a free open source peer-to-peer electronic cash system that is
completely decentralized, without the need for a central server or trusted
parties. Users hold the crypto keys to their own money and transact directly
with each other, with the help of a P2P network to check for double-spending.
'';
homepage = "http://www.bitcoin.org/";
maintainers = with maintainers; [ roconnor AndersonTorres ];
license = licenses.mit;
platforms = platforms.unix;
};
}

View File

@ -0,0 +1,40 @@
{ fetchurl, stdenv, pkgconfig
, openssl, db48, boost, zlib, miniupnpc, qt4, qrencode, glib, protobuf
, utillinux
, withGui }:
with stdenv.lib;
stdenv.mkDerivation rec {
name = "darkcoin" + (toString (optional (!withGui) "d")) + "-" + version;
version = "0.9.13.15";
src = fetchurl {
url = "https://github.com/darkcoin/darkcoin/archive/v${version}.tar.gz";
sha256 = "1kly2y3g4dr1jwwf81smqvc7k662x6rvg4ggmxva1yaifb67bgjb";
};
buildInputs = [ pkgconfig glib openssl db48 boost zlib miniupnpc ]
++ optionals withGui [ qt4 qrencode ];
configurePhase = optional withGui "qmake";
preBuild = optional (!withGui) "cd src; cp makefile.unix Makefile";
installPhase =
if withGui
then "install -D darkcoin-qt $out/bin/darkcoin-qt"
else "install -D darkcoind $out/bin/darkcoind";
meta = with stdenv.lib; {
description = "A decentralized key/value registration and transfer system";
longDescription = ''
Darkcoin (DRK) is an open sourced, privacy-centric digital
currency. It allows you keep your finances private as you make
transactions, similar to cash.
'';
homepage = http://darkcoin.io;
maintainers = with maintainers; [ AndersonTorres ];
platforms = with platforms; unix;
};
}

View File

@ -0,0 +1,19 @@
{ callPackage, pkgs }:
rec {
bitcoin = callPackage ./bitcoin.nix { withGui = true; };
bitcoind = callPackage ./bitcoin.nix { withGui = false; };
darkcoin = callPackage ./darkcoin.nix { withGui = true; };
darkcoind = callPackage ./darkcoin.nix { withGui = false; };
dogecoin = callPackage ./dogecoin.nix { withGui = true; };
dogecoind = callPackage ./dogecoin.nix { withGui = false; };
litecoin = callPackage ./litecoin.nix { withGui = true; };
litecoind = callPackage ./litecoin.nix { withGui = false; };
namecoin = callPackage ./namecoin.nix { inherit namecoind; };
namecoind = callPackage ./namecoind.nix { };
}

View File

@ -0,0 +1,47 @@
{ stdenv , fetchurl
, pkgconfig, autoreconfHook
, db5, openssl, boost, zlib, miniupnpc
, glib, protobuf, utillinux, qt4, qrencode
, withGui }:
with stdenv.lib;
stdenv.mkDerivation rec {
name = "dogecoin" + (toString (optional (!withGui) "d")) + "-" + version;
version = "1.8.0";
src = fetchurl {
url = "https://github.com/dogecoin/dogecoin/archive/v${version}.tar.gz";
sha256 = "8a33958c04213cd621aa3c86910477813af22512f03b47c98995d20d31f3f935";
};
buildInputs = [ autoreconfHook pkgconfig openssl
db5 openssl utillinux protobuf boost zlib miniupnpc ]
++ optionals withGui [ qt4 qrencode ];
# BSD DB5 location
patchPhase = ''
sed -i \
-e 's,BDB_CPPFLAGS=$,BDB_CPPFLAGS="-I${db5}/include",g' \
-e 's,BDB_LIBS=$,BDB_LIBS="-L${db5}/lib",g' \
-e 's,bdbdirlist=$,bdbdirlist="${db5}/include",g' \
src/m4/dogecoin_find_bdb51.m4
'';
configureFlags = [ "--with-incompatible-bdb"
"--with-boost-libdir=${boost.lib}/lib" ]
++ optionals withGui [ "--with-gui" ];
meta = {
description = "Wow, such coin, much shiba, very rich";
longDescription = ''
Dogecoin is a decentralized, peer-to-peer digital currency that
enables you to easily send money online. Think of it as "the
internet currency."
It is named after a famous Internet meme, the "Doge" - a Shiba Inu dog.
'';
homepage = http://www.dogecoin.com/;
license = licenses.mit;
maintainers = with maintainers; [ edwtjo offline AndersonTorres ];
};
}

View File

@ -0,0 +1,41 @@
{ stdenv, fetchurl
, pkgconfig, autoreconfHook
, openssl, db48, boost, zlib, miniupnpc
, glib, protobuf, utillinux, qt4, qrencode
, withGui }:
with stdenv.lib;
stdenv.mkDerivation rec {
name = "litecoin" + (toString (optional (!withGui) "d")) + "-" + version;
version = "0.9.3-preview5";
src = fetchurl {
url = "https://github.com/litecoin-project/litecoin/archive/v${version}.tar.gz";
sha256 = "0nnfz4s2g28jb5fqy6cabsryp3h2amzlyslr6g6k8r1vmzvx5ym6";
};
buildInputs = [ pkgconfig autoreconfHook openssl
openssl db48 boost zlib miniupnpc glib protobuf utillinux ]
++ optionals withGui [ qt4 qrencode ];
configureFlags = [ "--with-boost-libdir=${boost.lib}/lib" ]
++ optionals withGui [ "--with-gui=qt4" ];
meta = with stdenv.lib; {
description = "A lite version of Bitcoin using scrypt as a proof-of-work algorithm";
longDescription= ''
Litecoin is a peer-to-peer Internet currency that enables instant payments
to anyone in the world. It is based on the Bitcoin protocol but differs
from Bitcoin in that it can be efficiently mined with consumer-grade hardware.
Litecoin provides faster transaction confirmations (2.5 minutes on average)
and uses a memory-hard, scrypt-based mining proof-of-work algorithm to target
the regular computers and GPUs most people already have.
The Litecoin network is scheduled to produce 84 million currency units.
'';
homepage = https://litecoin.org/;
platforms = platforms.unix;
license = licenses.mit;
maintainers = with maintainers; [ offline AndersonTorres ];
};
}

View File

@ -0,0 +1,26 @@
{ stdenv, db4, boost, openssl, qt4, miniupnpc, unzip, namecoind }:
with stdenv.lib;
stdenv.mkDerivation rec {
name = "namecoin-${version}";
version = namecoind.version;
src = namecoind.src;
buildInputs = [ db4 boost openssl unzip qt4 miniupnpc ];
configurePhase = ''
qmake USE_UPNP=-
'';
buildPhase = ''
make
'';
installPhase = ''
mkdir -p $out/bin
cp namecoin-qt $out/bin
'';
meta = namecoind.meta;
}

View File

@ -0,0 +1,35 @@
{ stdenv, fetchurl, db4, boost, openssl, miniupnpc, unzip }:
with stdenv.lib;
stdenv.mkDerivation rec {
version = "0.3.76";
name = "namecoind-${version}";
src = fetchurl {
url = "https://github.com/namecoin/namecoin/archive/nc${version}.tar.gz";
sha256 = "007372j47hb7p89smh3w0p6z70gii9gd4v6agpycqiv4r3n9sv5v";
};
buildInputs = [ db4 boost openssl unzip miniupnpc ];
patchPhase = ''
sed -e 's/-Wl,-Bstatic//g' -e 's/-l gthread-2.0//g' -e 's/-l z//g' -i src/Makefile
'';
buildPhase = ''
make -C src INCLUDEPATHS= LIBPATHS=
'';
installPhase = ''
mkdir -p $out/bin
cp src/namecoind $out/bin
'';
meta = {
description = "Decentralized open source information registration and transfer system based on the Bitcoin cryptocurrency";
homepage = http://namecoin.info;
license = licenses.mit;
maintainers = with maintainers; [ doublec AndersonTorres ];
platforms = platforms.linux;
};
}

View File

@ -1,82 +0,0 @@
{ fetchurl, stdenv, pkgconfig
, openssl, db48, boost, zlib, miniupnpc, qt4, qrencode, glib, protobuf
, utillinux, autogen, autoconf, autobuild, automake, autoreconfHook, db }:
with stdenv.lib;
let
buildAltcoin = makeOverridable ({walletName, gui ? true, ...}@a:
stdenv.mkDerivation ({
name = "${walletName}${toString (optional (!gui) "d")}-${a.version}";
buildInputs = [ pkgconfig openssl db48 boost zlib miniupnpc ]
++ optionals gui [ qt4 qrencode ] ++ a.extraBuildInputs or [];
configurePhase = optional gui "qmake";
preBuild = optional (!gui) "cd src";
makefile = optional (!gui) "makefile.unix";
installPhase = if gui then ''
install -D "${walletName}-qt" "$out/bin/${walletName}-qt"
'' else ''
install -D "${walletName}d" "$out/bin/${walletName}d"
'';
passthru.walletName = walletName;
meta = {
platforms = platforms.unix;
license = license.mit;
maintainers = [ maintainers.offline ] ++ a.extraMaintainers;
};
} // a)
);
in rec {
inherit buildAltcoin;
namecoin = buildAltcoin rec {
walletName = "namecoin";
version = "0.3.51.00";
gui = false;
src = fetchurl {
url = "https://github.com/namecoin/namecoin/archive/nc${version}.tar.gz";
sha256 = "0r6zjzichfjzhvpdy501gwy9h3zvlla3kbgb38z1pzaa0ld9siyx";
};
patches = [ ./namecoin_dynamic.patch ];
extraBuildInputs = [ glib ];
meta = {
description = "A decentralized key/value registration and transfer system based on Bitcoin technology";
homepage = http://namecoin.info;
};
};
darkcoin = buildAltcoin rec {
walletName = "darkcoin";
version = "0.9.13.15";
src = fetchurl {
url = "https://github.com/darkcoin/darkcoin/archive/v${version}.tar.gz";
sha256 = "1kly2y3g4dr1jwwf81smqvc7k662x6rvg4ggmxva1yaifb67bgjb";
};
extraBuildInputs = [ glib ];
meta = {
description = "A decentralized key/value registration and transfer system";
longDescription = ''
Darkcoin (DRK) is an open sourced, privacy-centric digital
currency. It allows you keep your finances private as you make
transactions, similar to cash.
'';
homepage = http://darkcoin.io;
extraMaintainers = [ maintainers.AndersonTorres ];
};
};
darkcoind = darkcoin.override { gui = false; };
}

View File

@ -1,52 +0,0 @@
{ fetchurl, stdenv, openssl, db48, boost, zlib, miniupnpc, qt4, utillinux
, pkgconfig, protobuf, qrencode, gui ? true }:
with stdenv.lib;
stdenv.mkDerivation rec {
version = "0.9.3";
name = "bitcoin${toString (optional (!gui) "d")}-${version}";
src = fetchurl {
url = "https://bitcoin.org/bin/${version}/bitcoin-${version}-linux.tar.gz";
sha256 = "1kb59w7232qzfh952rz6vvjri2w26n9cq7baml0vifdsdhxph9f4";
};
# hexdump from utillinux is required for tests
buildInputs = [
openssl db48 boost zlib miniupnpc utillinux pkgconfig protobuf
] ++ optionals gui [ qt4 qrencode ];
unpackPhase = ''
mkdir tmp-extract && (cd tmp-extract && tar xf $src)
tar xf tmp-extract/bitcoin*/src/bitcoin*.tar*
cd bitcoin*
'';
preCheck = ''
# At least one test requires writing in $HOME
HOME=$TMPDIR
'';
configureFlags = [ "--with-boost-libdir=${boost.lib}/lib" ];
doCheck = true;
enableParallelBuilding = true;
passthru.walletName = "bitcoin";
meta = {
description = "Peer-to-peer electronic cash system";
longDescription= ''
Bitcoin is a free open source peer-to-peer electronic cash system that is
completely decentralized, without the need for a central server or trusted
parties. Users hold the crypto keys to their own money and transact directly
with each other, with the help of a P2P network to check for double-spending.
'';
homepage = "http://www.bitcoin.org/";
maintainers = [ maintainers.roconnor ];
license = licenses.mit;
platforms = platforms.unix;
};
}

View File

@ -1,70 +0,0 @@
{ fetchurl, stdenv, pkgconfig
, openssl, boost, zlib, miniupnpc, qt4, qrencode, glib, protobuf
, utillinux, autogen, autoconf, autobuild, automake, db }:
with stdenv.lib;
let
mkAutotoolCoin =
{ name, version, withGui, src, meta }:
stdenv.mkDerivation {
inherit src meta;
name = name + (toString (optional (!withGui) "d")) + "-" + version;
buildInputs = [ autogen autoconf automake pkgconfig openssl
boost zlib miniupnpc db utillinux protobuf ]
++ optionals withGui [ qt4 qrencode ];
patchPhase = ''
sed -i \
-e 's,BDB_CPPFLAGS=$,BDB_CPPFLAGS="-I${db}/include",g' \
-e 's,BDB_LIBS=$,BDB_LIBS="-L${db}/lib",g' \
-e 's,bdbdirlist=$,bdbdirlist="${db}/include",g' \
src/m4/dogecoin_find_bdb51.m4
'';
configurePhase = ''
./autogen.sh \
&& ./configure --prefix=$out \
--with-incompatible-bdb \
${ if withGui then "--with-gui" else "" }
'';
installPhase = ''
install -D "src/dogecoin-cli" "$out/bin/dogecoin-cli"
install -D "src/dogecoind" "$out/bin/dogecoind"
${ if withGui then "install -D src/qt/dogecoin-qt $out/bin/dogecoin-qt" else "" }
'';
};
mkDogeCoin = { withGui }:
mkAutotoolCoin rec {
name = "dogecoin";
version = "1.8.0";
inherit withGui;
src = fetchurl {
url = "https://github.com/dogecoin/dogecoin/archive/v${version}.tar.gz";
sha256 = "8a33958c04213cd621aa3c86910477813af22512f03b47c98995d20d31f3f935";
};
meta = {
description = "Wow, such coin, much shiba, very rich";
longDescription = "wow";
homepage = http://www.dogecoin.com/;
license = licenses.mit;
maintainers = with maintainers; [ edwtjo offline ];
};
};
in {
dogecoin = mkDogeCoin { withGui = true; };
dogecoind = mkDogeCoin { withGui = false; };
}

View File

@ -1,60 +0,0 @@
{ stdenv, fetchurl, pkgconfig
, openssl, db48, boost, zlib, miniupnpc, qt4, qrencode, glib, protobuf
, utillinux, autogen, autoreconfHook }:
with stdenv.lib;
let
mkAutoreconfCoin =
{ name, version, withGui, src, meta }:
stdenv.mkDerivation {
inherit src meta;
name = name + (toString (optional (!withGui) "d")) + "-" + version;
buildInputs = [ autogen autoreconfHook pkgconfig openssl
boost zlib miniupnpc db48 glib utillinux protobuf ]
++ optionals withGui [ qt4 qrencode protobuf ];
configureFlags = [ "--with-boost-libdir=${boost.lib}/lib" ] ++ optionals withGui [ "--with-gui=qt4" ];
};
mkLitecoin = { withGui }:
mkAutoreconfCoin rec {
name = "litecoin";
version = "0.9.3-preview5";
inherit withGui;
src = fetchurl {
url = "https://github.com/litecoin-project/litecoin/archive/v${version}.tar.gz";
sha256 = "0nnfz4s2g28jb5fqy6cabsryp3h2amzlyslr6g6k8r1vmzvx5ym6";
};
meta = with stdenv.lib; {
description = "A lite version of Bitcoin using scrypt as a proof-of-work algorithm";
longDescription= ''
Litecoin is a peer-to-peer Internet currency that enables instant payments
to anyone in the world. It is based on the Bitcoin protocol but differs
from Bitcoin in that it can be efficiently mined with consumer-grade hardware.
Litecoin provides faster transaction confirmations (2.5 minutes on average)
and uses a memory-hard, scrypt-based mining proof-of-work algorithm to target
the regular computers and GPUs most people already have.
The Litecoin network is scheduled to produce 84 million currency units.
'';
homepage = https://litecoin.org/;
platforms = platforms.unix;
license = licenses.mit;
maintainers = [ maintainers.offline maintainers.AndersonTorres ];
};
};
in {
litecoin = mkLitecoin { withGui = true; };
litecoind = mkLitecoin { withGui = false; };
}

View File

@ -1,11 +0,0 @@
diff -u -r a/src/makefile.unix b/src/makefile.unix
--- a/src/makefile.unix 2014-01-22 22:07:59.801601964 -0800
+++ b/src/makefile.unix 2014-01-22 22:08:07.980332839 -0800
@@ -12,7 +12,6 @@
# for boost 1.37, add -mt to the boost libraries
LIBS= \
- -Wl,-Bstatic \
-l boost_system \
-l boost_filesystem \
-l boost_program_options \

View File

@ -1,37 +0,0 @@
{ fetchgit, stdenv, db4, boost, openssl, unzip }:
stdenv.mkDerivation rec {
version = "0.3.76";
name = "namecoin-${version}";
src = fetchgit {
url = "https://github.com/namecoin/namecoin";
rev = "224175ca3bba6eea6f6b1bdb007b482eb2bd2aee";
sha256 = "3ccfb6fdda1b9d105e775eb19c696be7fec1b3671f9b4f43d02fa14a4c6848dd";
};
# Don't build with miniupnpc due to namecoin using a different verison that
# ships with NixOS and it is API incompatible.
buildInputs = [ db4 boost openssl unzip ];
patchPhase = ''
sed -e 's/-Wl,-Bstatic//g' -e 's/-l gthread-2.0//g' -e 's/-l z//g' -i src/Makefile
'';
buildPhase = ''
make -C src INCLUDEPATHS= LIBPATHS=
'';
installPhase = ''
mkdir -p $out/bin
cp src/namecoind $out/bin
'';
meta = {
description = "Decentralized open source information registration and transfer system based on the Bitcoin cryptocurrency";
homepage = "http://namecoin.info";
license = stdenv.lib.licenses.mit;
maintainers = [ stdenv.lib.maintainers.doublec ];
platforms = with stdenv.lib.platforms; linux;
};
}

View File

@ -1,33 +0,0 @@
{ fetchgit, stdenv, db4, boost, openssl, qt4, unzip, namecoin }:
stdenv.mkDerivation rec {
version = namecoin.version;
name = "namecoin-qt-${version}";
src = namecoin.src;
# Don't build with miniupnpc due to namecoin using a different verison that
# ships with NixOS and it is API incompatible.
buildInputs = [ db4 boost openssl unzip qt4 ];
configurePhase = ''
qmake USE_UPNP=-
'';
buildPhase = ''
make
'';
installPhase = ''
mkdir -p $out/bin
cp namecoin-qt $out/bin
'';
meta = {
description = "Decentralized open source information registration and transfer system based on the Bitcoin cryptocurrency";
homepage = "http://namecoin.info";
license = stdenv.lib.licenses.mit;
maintainers = [ stdenv.lib.maintainers.doublec ];
platforms = with stdenv.lib.platforms; linux;
};
}

View File

@ -9158,6 +9158,9 @@ let
schismtracker = callPackage ../applications/audio/schismtracker { };
altcoins = recurseIntoAttrs ( callPackage ../applications/altcoins { } );
bitcoin = altcoins.bitcoin;
aumix = callPackage ../applications/audio/aumix {
gtkGUI = false;
};
@ -9215,15 +9218,6 @@ let
bibletime = callPackage ../applications/misc/bibletime { };
bitcoin = callPackage ../applications/misc/bitcoin {};
bitcoind = callPackage ../applications/misc/bitcoin { gui = false; };
altcoins = recurseIntoAttrs (
(callPackage ../applications/misc/bitcoin/altcoins.nix {}) //
(callPackage ../applications/misc/bitcoin/dogecoin.nix {}) //
(callPackage ../applications/misc/bitcoin/litecoin.nix {})
);
bitlbee = callPackage ../applications/networking/instant-messengers/bitlbee { };
blender = callPackage ../applications/misc/blender {
@ -10422,9 +10416,6 @@ let
withSidebar = true;
};
namecoin = callPackage ../applications/misc/namecoin { };
namecoinqt = callPackage ../applications/misc/namecoin/qt.nix { };
pcmanfm = callPackage ../applications/misc/pcmanfm { };
ruby_gpgme = callPackage ../development/libraries/ruby_gpgme {