From 7a794e17978d110bde3e9dec96e9e5de50e7831b Mon Sep 17 00:00:00 2001
From: codyopel <codyopel@gmail.com>
Date: Sat, 9 May 2015 18:20:02 -0400
Subject: [PATCH] libsodium: refactor & remove duplicate

---
 .../haskell-modules/hackage-packages.nix      |  6 ++--
 .../libraries/libsodium/default.nix           | 11 ++++----
 pkgs/development/libraries/sodium/default.nix | 28 -------------------
 .../libraries/sodium/default.upstream         |  1 -
 pkgs/servers/nosql/hyperdex/default.nix       |  2 +-
 pkgs/servers/nosql/hyperdex/libmacaroons.nix  |  4 +--
 pkgs/top-level/all-packages.nix               |  2 --
 7 files changed, 12 insertions(+), 42 deletions(-)
 delete mode 100644 pkgs/development/libraries/sodium/default.nix
 delete mode 100644 pkgs/development/libraries/sodium/default.upstream

diff --git a/pkgs/development/haskell-modules/hackage-packages.nix b/pkgs/development/haskell-modules/hackage-packages.nix
index 56c6418afc6b..7c724523c5d7 100644
--- a/pkgs/development/haskell-modules/hackage-packages.nix
+++ b/pkgs/development/haskell-modules/hackage-packages.nix
@@ -107016,7 +107016,7 @@ self: {
 
   "saltine-quickcheck" = callPackage
     ({ mkDerivation, base, bytestring, bytestring-arbitrary, hex
-     , QuickCheck, saltine, sodium, tasty, tasty-quickcheck
+     , QuickCheck, saltine, libsodium, tasty, tasty-quickcheck
      }:
      mkDerivation {
        pname = "saltine-quickcheck";
@@ -107028,12 +107028,12 @@ self: {
        testDepends = [
          base bytestring-arbitrary QuickCheck saltine tasty tasty-quickcheck
        ];
-       extraLibraries = [ sodium ];
+       extraLibraries = [ libsodium ];
        jailbreak = true;
        homepage = "https://github.com/tsuraan/saltine-quickcheck";
        description = "Quickcheck implementations for some NaCl data";
        license = stdenv.lib.licenses.mit;
-     }) { inherit (pkgs) sodium;};
+     }) { inherit (pkgs) libsodium;};
 
   "salvia" = callPackage
     ({ mkDerivation, base, bytestring, containers, directory, fclabels
diff --git a/pkgs/development/libraries/libsodium/default.nix b/pkgs/development/libraries/libsodium/default.nix
index dfe462c301ae..ea3bbbede2a8 100644
--- a/pkgs/development/libraries/libsodium/default.nix
+++ b/pkgs/development/libraries/libsodium/default.nix
@@ -12,10 +12,11 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  meta = {
-    description = "Version of NaCl with hardware tests at runtime, not build time";
-    license = stdenv.lib.licenses.isc;
-    maintainers = with stdenv.lib.maintainers; [ viric ];
-    platforms = stdenv.lib.platforms.all;
+  meta = with stdenv.lib; {
+    description = "A modern and easy-to-use crypto library";
+    homepage = http://doc.libsodium.org/;
+    license = licenses.isc;
+    maintainers = with maintainers; [ raskin viric ];
+    platforms = platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/sodium/default.nix b/pkgs/development/libraries/sodium/default.nix
deleted file mode 100644
index 7bdec155813b..000000000000
--- a/pkgs/development/libraries/sodium/default.nix
+++ /dev/null
@@ -1,28 +0,0 @@
-{stdenv, fetchurl}:
-let
-  s = # Generated upstream information
-  rec {
-    baseName="sodium";
-    version="1.0.2";
-    name="${baseName}-${version}";
-    hash="06dabf77cz6qg7aqv5j5r4m32b5zn253pixwb3k5lm3z0h88y7cn";
-    url="http://download.dnscrypt.org/libsodium/releases/libsodium-1.0.2.tar.gz";
-    sha256="06dabf77cz6qg7aqv5j5r4m32b5zn253pixwb3k5lm3z0h88y7cn";
-  };
-  buildInputs = [
-  ];
-in
-stdenv.mkDerivation {
-  inherit (s) name version;
-  inherit buildInputs;
-  src = fetchurl {
-    inherit (s) url sha256;
-  };
-  meta = {
-    inherit (s) version;
-    description = ''A cryptography library with simple API'';
-    license = stdenv.lib.licenses.mit ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
-  };
-}
diff --git a/pkgs/development/libraries/sodium/default.upstream b/pkgs/development/libraries/sodium/default.upstream
deleted file mode 100644
index ccc02cd89785..000000000000
--- a/pkgs/development/libraries/sodium/default.upstream
+++ /dev/null
@@ -1 +0,0 @@
-url http://download.dnscrypt.org/libsodium/releases/
diff --git a/pkgs/servers/nosql/hyperdex/default.nix b/pkgs/servers/nosql/hyperdex/default.nix
index 7ed3661b87ff..659081281ef0 100644
--- a/pkgs/servers/nosql/hyperdex/default.nix
+++ b/pkgs/servers/nosql/hyperdex/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, makeWrapper, unzip, autoconf, automake, libtool,
-  python, sodium, pkgconfig, popt, glog, xz, json_c, gperf, yacc,
+  python, libsodium, pkgconfig, popt, glog, xz, json_c, gperf, yacc,
   flex, pandoc, help2man, autoconf-archive, callPackage }:
 
 assert stdenv.isLinux;
diff --git a/pkgs/servers/nosql/hyperdex/libmacaroons.nix b/pkgs/servers/nosql/hyperdex/libmacaroons.nix
index 2d709c5bbd1d..5d91a82a8ec6 100644
--- a/pkgs/servers/nosql/hyperdex/libmacaroons.nix
+++ b/pkgs/servers/nosql/hyperdex/libmacaroons.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, unzip, autoconf, automake, libtool, 
-  pkgconfig, sodium, python }:
+  pkgconfig, libsodium, python }:
 stdenv.mkDerivation rec {
   name = "libmacaroons-${version}";
   version = "HEAD";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     url = "https://github.com/rescrv/libmacaroons/archive/6febf3ce6c4c77a46d24b40ed29b03ffbfb175a7.zip";
     sha256 = "0b4qgim87398chvc3qhxfqv2l1cyl65rhyknln8lk0gq9y00p1ik";
   };
-  buildInputs = [ unzip autoconf automake libtool python sodium pkgconfig ];
+  buildInputs = [ unzip autoconf automake libtool python libsodium pkgconfig ];
   preConfigure = "autoreconf -i";
   
   meta = with stdenv.lib; {
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 3269737a3b35..085477d2ed67 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -7649,8 +7649,6 @@ let
 
   socket_wrapper = callPackage ../development/libraries/socket_wrapper { };
 
-  sodium = callPackage ../development/libraries/sodium {};
-
   sofia_sip = callPackage ../development/libraries/sofia-sip { };
 
   soprano = callPackage ../development/libraries/soprano { };