From 86571294f5196af933146ce6e53fb02f9ef57ddf Mon Sep 17 00:00:00 2001
From: ndowens <ndowens04@gmail.com>
Date: Sun, 19 Mar 2017 18:32:47 -0500
Subject: [PATCH] calcurse: 4.0.0 -> 4.2.2

---
 pkgs/applications/misc/calcurse/default.nix | 25 ++++++++++++---------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/pkgs/applications/misc/calcurse/default.nix b/pkgs/applications/misc/calcurse/default.nix
index 9211ef0ab83..3f22d1629e2 100644
--- a/pkgs/applications/misc/calcurse/default.nix
+++ b/pkgs/applications/misc/calcurse/default.nix
@@ -1,18 +1,23 @@
-{stdenv, fetchurl, ncurses, gettext}:
+{stdenv, fetchurl, ncurses, gettext, python3, makeWrapper }:
 
-stdenv.mkDerivation {
-  name = "calcurse-4.0.0";
+stdenv.mkDerivation rec {
+  name = "calcurse-${version}";
+  version = "4.2.2";
 
   src = fetchurl {
-    url = http://calcurse.org/files/calcurse-4.0.0.tar.gz;
-    sha256 = "0d33cpkbhyidvm3xx6iw9ljqdvl6477c2kcwix3bs63nj0ch06v2";
+    url = "http://calcurse.org/files/${name}.tar.gz";
+    sha256 = "0il0y06akdqgy0f9p40m4x6arn66nh7sr1w1i41bszycs7div266";
   };
 
-  buildInputs = [ncurses gettext];
+  buildInputs = [ncurses gettext python3 ];
+  nativeBuildInputs = [ makeWrapper ];
 
-  meta = {
+  postInstall = ''
+    makeWrapper ${python3}/bin/python3 $out/bin/calcurse-caldav 
+      '';
+
+  meta = with stdenv.lib; {
     description = "A calendar and scheduling application for the command line";
-    version = "4.0.0";
     longDescription = ''
       calcurse is a calendar and scheduling application for the command line. It helps
       keep track of events, appointments and everyday tasks. A configurable notification
@@ -21,7 +26,7 @@ stdenv.mkDerivation {
       be used to filter and format appointments, making it suitable for use in scripts.
     '';
     homepage = http://calcurse.org/;
-    license = stdenv.lib.licenses.bsd2;
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.bsd2;
+    platforms = platforms.linux;
   };
 }