From 20020d3ec8764d119df541d4ceae1d2a81f909df Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Wed, 5 May 2021 12:22:59 +0200 Subject: [PATCH] haskellPackages.hnix: unbreak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mystery build failure was caused by having the same instance as an orphan and imported from ref-tf 0.5 (why ever that doesn't warrant a logged error messageā€¦). The solution for this is https://github.com/haskell-nix/hnix/pull/918, which sadly doesn't apply cleanly on the hnix 0.12.0.1 tarball. Therefore I've backported the patch until hnix hopefully gets a new hackage release soon. --- .../haskell-modules/configuration-common.nix | 14 +++++++- .../patches/hnix-ref-tf-0.5-support.patch | 34 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/haskell-modules/patches/hnix-ref-tf-0.5-support.patch diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 1b51fe615caa..b0ff20c4cf78 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -197,7 +197,19 @@ self: super: { digit = doJailbreak super.digit; # 2020-06-05: HACK: does not pass own build suite - `dontCheck` - hnix = generateOptparseApplicativeCompletion "hnix" (dontCheck super.hnix); + hnix = generateOptparseApplicativeCompletion "hnix" + (overrideCabal super.hnix (drv: { + doCheck = false; + prePatch = '' + # fix encoding problems when patching + ${pkgs.dos2unix}/bin/dos2unix hnix.cabal + '' + (drv.prePatch or ""); + patches = [ + # support ref-tf in hnix 0.12.0.1, can be removed after + # https://github.com/haskell-nix/hnix/pull/918 + ./patches/hnix-ref-tf-0.5-support.patch + ] ++ (drv.patches or []); + })); # Fails for non-obvious reasons while attempting to use doctest. search = dontCheck super.search; diff --git a/pkgs/development/haskell-modules/patches/hnix-ref-tf-0.5-support.patch b/pkgs/development/haskell-modules/patches/hnix-ref-tf-0.5-support.patch new file mode 100644 index 000000000000..5a4d0446e713 --- /dev/null +++ b/pkgs/development/haskell-modules/patches/hnix-ref-tf-0.5-support.patch @@ -0,0 +1,34 @@ +diff '--color=auto' '--color=never' -r --unified hnix-0.12.0.1/hnix.cabal hnix-patched/hnix.cabal +--- hnix-0.12.0.1/hnix.cabal 2001-09-09 03:46:40.000000000 +0200 ++++ hnix-patched/hnix.cabal 2021-05-05 12:07:38.388267353 +0200 +@@ -430,7 +430,7 @@ + , parser-combinators >= 1.0.1 && < 1.3 + , prettyprinter >= 1.7.0 && < 1.8 + , process >= 1.6.3 && < 1.7 +- , ref-tf >= 0.4.0 && < 0.5 ++ , ref-tf >= 0.5 + , regex-tdfa >= 1.2.3 && < 1.4 + , scientific >= 0.3.6 && < 0.4 + , semialign >= 1 && < 1.2 +diff '--color=auto' '--color=never' -r --unified hnix-0.12.0.1/src/Nix/Fresh.hs hnix-patched/src/Nix/Fresh.hs +--- hnix-0.12.0.1/src/Nix/Fresh.hs 2001-09-09 03:46:40.000000000 +0200 ++++ hnix-patched/src/Nix/Fresh.hs 2021-05-05 12:07:45.841267497 +0200 +@@ -65,18 +65,3 @@ + + runFreshIdT :: Functor m => Var m i -> FreshIdT i m a -> m a + runFreshIdT i m = runReaderT (unFreshIdT m) i +- +--- Orphan instance needed by Infer.hs and Lint.hs +- +--- Since there's no forking, it's automatically atomic. +-instance MonadAtomicRef (ST s) where +- atomicModifyRef r f = do +- v <- readRef r +- let (a, b) = f v +- writeRef r a +- return b +- atomicModifyRef' r f = do +- v <- readRef r +- let (a, b) = f v +- writeRef r $! a +- return b