From 9f00b07aa40fd776706239b427424408a54cb2bc Mon Sep 17 00:00:00 2001
From: Sebastien Maret <sebastien.maret@univ-grenoble-alpes.fr>
Date: Thu, 14 Jun 2018 00:41:03 +0200
Subject: [PATCH 1/2] ispell: fix compilation on Darwin

Closes #41948.
---
 pkgs/tools/text/ispell/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/tools/text/ispell/default.nix b/pkgs/tools/text/ispell/default.nix
index b2219d1e66d6..d35a3d61b1b4 100644
--- a/pkgs/tools/text/ispell/default.nix
+++ b/pkgs/tools/text/ispell/default.nix
@@ -22,8 +22,8 @@ stdenv.mkDerivation rec {
     ./patches/0030-Display-whole-multibyte-character.patch
   ];
   postPatch = ''
+    if [ ! stdenv.isDarwin ]; then echo "#define USG" >> local.h; fi
     cat >> local.h <<EOF
-    #define USG
     #define TERMLIB "-lncurses"
     #define LANGUAGES "{american,MASTERDICTS=american.med,HASHFILES=americanmed.hash}"
     #define MASTERHASH "americanmed.hash"

From aa68838ea780a33466c4219f4b723e1bd98e4352 Mon Sep 17 00:00:00 2001
From: Sebastien Maret <sebastien.maret@univ-grenoble-alpes.fr>
Date: Thu, 14 Jun 2018 01:13:10 +0200
Subject: [PATCH 2/2] ispell: use optionalString instead of a bash conditional

---
 pkgs/tools/text/ispell/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/tools/text/ispell/default.nix b/pkgs/tools/text/ispell/default.nix
index d35a3d61b1b4..dbec8d353d94 100644
--- a/pkgs/tools/text/ispell/default.nix
+++ b/pkgs/tools/text/ispell/default.nix
@@ -22,8 +22,8 @@ stdenv.mkDerivation rec {
     ./patches/0030-Display-whole-multibyte-character.patch
   ];
   postPatch = ''
-    if [ ! stdenv.isDarwin ]; then echo "#define USG" >> local.h; fi
     cat >> local.h <<EOF
+    ${stdenv.lib.optionalString (!stdenv.isDarwin) "#define USG"}
     #define TERMLIB "-lncurses"
     #define LANGUAGES "{american,MASTERDICTS=american.med,HASHFILES=americanmed.hash}"
     #define MASTERHASH "americanmed.hash"