From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Wed, 29 Apr 2015 00:08:07 +0000 (+0530)
Subject: WIP: FuncTorrent as a nix package
X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/flags/@manifest?a=commitdiff_plain;h=dfeda8f6e4922ae994d1597bbacb906d40cc2c1f;p=functorrent.git

WIP: FuncTorrent as a nix package
---

diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..32a0078
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,27 @@
+# This file was auto-generated by cabal2nix. Please do NOT edit manually!
+
+{ cabal, base16Bytestring, binary, cryptohash, doctest, hlint, HTTP
+, networkUri, parsec, QuickCheck, tasty, tastyHunit
+, tastyQuickcheck, testFrameworkQuickcheck2
+}:
+
+cabal.mkDerivation (self: {
+  pname = "functorrent";
+  version = "0.1.0.0";
+  src = ./.;
+  isLibrary = true;
+  isExecutable = true;
+  buildDepends = [
+    base16Bytestring binary cryptohash HTTP networkUri parsec
+    QuickCheck tasty tastyHunit
+  ];
+  testDepends = [
+    doctest hlint QuickCheck tasty tastyHunit tastyQuickcheck
+    testFrameworkQuickcheck2
+  ];
+  meta = {
+    description = "A Bit-torrent client";
+    license = self.stdenv.lib.licenses.gpl3;
+    platforms = self.ghc.meta.platforms;
+  };
+})
diff --git a/shell.nix b/shell.nix
index 4016503..b3b0789 100644
--- a/shell.nix
+++ b/shell.nix
@@ -1,22 +1,12 @@
-# This file was auto-generated by cabal2nix. Please do NOT edit manually!
-
-{ haskellPackages ? (import <nixpkgs> {}).haskellPackages }:
-
-with haskellPackages; cabal.mkDerivation (self: {
-  pname = "functorrent";
-  version = "0.1.0.0";
-  src = "./.";
-  isLibrary = true;
-  isExecutable = true;
-  buildTools = [ cabalInstall ];
-  buildDepends = [
-    base16Bytestring binary cryptohash HTTP networkUri parsec tasty
-    tastyHunit
+let pkgs = (import <nixpkgs> {});
+    haskellPackages = pkgs.recurseIntoAttrs (pkgs.haskellPackages.override {
+        extension = self : super :
+        let callPackage = self.callPackage;
+        in {
+          thisPackage = haskellPackages.callPackage (import ./default.nix) {};
+        };});
+in pkgs.lib.overrideDerivation haskellPackages.thisPackage (old: {
+  buildInputs = old.buildInputs ++ [
+    haskellPackages.cabalInstall
   ];
-  testDepends = [ doctest hlint QuickCheck tasty tastyHunit ];
-  meta = {
-    description = "A Bit-torrent client";
-    license = self.stdenv.lib.licenses.gpl3;
-    platforms = self.ghc.meta.platforms;
-  };
 })