>From bb29ee8ccc656b86039127b31fd8b79533927053 Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Wed, 2 Jan 2019 16:40:48 -0500 Subject: [PATCH] gnu: ghc: Sort packages before writing binary cache. This improves the reproducibility of packages built with the Haskell build system. * gnu/packages/haskell.scm (ghc)[arguments]: Add a phase that patches 'ghc-pkg' so that it sorts packages before generating a binary cache. --- gnu/packages/haskell.scm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm index 8d0e2aef6..1a751a5b4 100644 --- a/gnu/packages/haskell.scm +++ b/gnu/packages/haskell.scm @@ -14,7 +14,7 @@ ;;; Copyright © 2017 rsiddharth ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice ;;; Copyright © 2018 Tonton -;;; Copyright © 2018 Timothy Sample +;;; Copyright © 2018, 2019 Timothy Sample ;;; Copyright © 2018 Arun Isaac ;;; ;;; This file is part of GNU Guix. @@ -508,6 +508,18 @@ interactive environment for the functional language Haskell.") (assoc-ref inputs "ghc-testsuite") "--strip-components=1") #t)) + ;; This phase patches the 'ghc-pkg' command so that it sorts + ;; the list of packages in the binary cache it generates. + (add-after 'unpack 'patch-ghc-pkg + (lambda _ + (substitute* "utils/ghc-pkg/Main.hs" + (("import Data.List") + (string-append "import Data.List\n" + "import Data.Ord (comparing)")) + (("pkgsCabalFormat = packages db") + (string-append "pkgsCabalFormat = sortBy" + " (comparing (display . installedUnitId))" + " (packages db)"))))) (add-after 'unpack-testsuite 'fix-shell-wrappers (lambda _ (substitute* '("driver/ghci/ghc.mk" -- 2.20.1