From 96e39cf8755431e7ffadebd436b93ed9154dfe1d Mon Sep 17 00:00:00 2001 From: Nicolas Pouillard Date: Tue, 16 Dec 2014 01:25:01 +0100 Subject: [PATCH] dist: builds with nix now --- c2n-regen.sh | 4 ++++ default.nix | 24 ++++++++++++++++++++++++ hx.cabal | 6 +++++- nix/RFC1751.nix | 26 ++++++++++++++++++++++++++ shell.nix | 13 +++++++++++++ 5 files changed, 72 insertions(+), 1 deletion(-) create mode 100755 c2n-regen.sh create mode 100644 default.nix create mode 100644 nix/RFC1751.nix create mode 100644 shell.nix diff --git a/c2n-regen.sh b/c2n-regen.sh new file mode 100755 index 0000000..9fe1f98 --- /dev/null +++ b/c2n-regen.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cabal2nix ./. > default.nix +#cabal2nix cabal://RFC1751 > nix/RFC1751.nix +cabal2nix --rev=cb6b960262ce1a7f598a3d08d00a2c348dfed91e git://github.com/np/RFC1751.git > nix/RFC1751.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..828eb2e --- /dev/null +++ b/default.nix @@ -0,0 +1,24 @@ +# This file was auto-generated by cabal2nix. Please do NOT edit manually! + +{ cabal, aeson, attoparsec, base16Bytestring, binary, cryptohash +, either, hashable, haskoin, RFC1751, scientific, text +, unorderedContainers +}: + +cabal.mkDerivation (self: { + pname = "hx"; + version = "0.1.0.0"; + src = ./.; + isLibrary = false; + isExecutable = true; + buildDepends = [ + aeson attoparsec base16Bytestring binary cryptohash either hashable + haskoin RFC1751 scientific text unorderedContainers + ]; + meta = { + homepage = "https://github.com/np/hx"; + description = "Bitcoin CLI tools: Haskell port of Sx using Haskoin"; + license = self.stdenv.lib.licenses.gpl3; + platforms = self.ghc.meta.platforms; + }; +}) diff --git a/hx.cabal b/hx.cabal index 501458c..580e40e 100644 --- a/hx.cabal +++ b/hx.cabal @@ -17,7 +17,11 @@ executable hx ghc-options: -Wall build-depends: base >=4.6, haskoin, bytestring, base16-bytestring, scientific, binary, RFC1751 >= 0.3, containers, - aeson, cryptohash + aeson, cryptohash, + -- required by aeson + attoparsec, hashable, unordered-containers, text, + -- required by haskoin + either default-language: Haskell2010 -- other-modules: -- other-extensions: diff --git a/nix/RFC1751.nix b/nix/RFC1751.nix new file mode 100644 index 0000000..45460c4 --- /dev/null +++ b/nix/RFC1751.nix @@ -0,0 +1,26 @@ +# This file was auto-generated by cabal2nix. Please do NOT edit manually! + +{ cabal, binary, fetchgit, HUnit, QuickCheck, testFramework +, testFrameworkHunit, testFrameworkQuickcheck2 +}: + +cabal.mkDerivation (self: { + pname = "RFC1751"; + version = "0.3.0.0"; + src = fetchgit { + url = "git://github.com/np/RFC1751.git"; + sha256 = "bca0caaa073d1a0d828b08632838f414d3358db90e7f4d43045a028540f25327"; + rev = "cb6b960262ce1a7f598a3d08d00a2c348dfed91e"; + }; + buildDepends = [ binary ]; + testDepends = [ + binary HUnit QuickCheck testFramework testFrameworkHunit + testFrameworkQuickcheck2 + ]; + meta = { + homepage = "https://github.com/xenog/RFC1751"; + description = "RFC-1751 library for Haskell"; + license = self.stdenv.lib.licenses.publicDomain; + platforms = self.ghc.meta.platforms; + }; +}) diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..8730cbd --- /dev/null +++ b/shell.nix @@ -0,0 +1,13 @@ +let pkgs = (import {}); + haskellPackages = pkgs.recurseIntoAttrs (pkgs.haskellPackages.override { + extension = self : super : + let callPackage = self.callPackage; + in { + RFC1751 = callPackage ./nix/RFC1751.nix {}; + thisPackage = haskellPackages.callPackage (import ./default.nix) {}; + };}); +in pkgs.lib.overrideDerivation haskellPackages.thisPackage (old: { + buildInputs = old.buildInputs ++ [ + haskellPackages.cabalInstall + # (2) + ];})