Open Fuuzetsu opened 5 years ago
(is @peti still the person in charge of Haskell infra?)
I'm hitting the same issue. I solved it manually by removing gtk2hs-buildtools
from the nativeBuildInputs
. e.g.:
hackGtk2Hs = p : p.overrideAttrs (oldAttrs: {
nativeBuildInputs = (builtins.filter
(p :
!isNull p &&
(builtins.parseDrvName (p.name)).name != "gtk2hs-buildtools")
oldAttrs.nativeBuildInputs
) ++ [self.gtk2hs-buildtools];
});
glib = hackGtk2Hs (super.glib);
gio = hackGtk2Hs super.gio;
cairo = hackGtk2Hs super.cairo;
pango = hackGtk2Hs super.pango;
Haskell attribute sets do not have overrideScope
like sets created with makeScope
do, but you can override the overrides argument of the compiler packages. See https://nixos.org/nixpkgs/manual/#how-to-override-package-versions-in-a-compiler-specific-package-set and https://nixos.org/nixpkgs/manual/#how-to-override-packages-in-all-compiler-specific-package-sets
I solved it like this:
{
haskellPackages = super.haskellPackages.override {
overrides = self: hsuper: rec {
gtk2hs-buildtools = overrideCabal hsuper.gtk2hs-buildtools (_: {
patches = [
./patches/gtk2hs-buildtools/ghc-8.6.1.patch
];
});
buildHaskellPackages = hsuper.buildHaskellPackages // { inherit gtk2hs-buildtools; };
};
};
}
The patch I'm using is based on the one from @Fuuzetsu at https://github.com/gtk2hs/gtk2hs/issues/254. I'll attach it.
diff --git a/c2hs/base/state/StateBase.hs b/c2hs/base/state/StateBase.hs
index aebd885..df50c77 100644
--- a/c2hs/base/state/StateBase.hs
+++ b/c2hs/base/state/StateBase.hs
@@ -58,6 +58,7 @@ where
import Control.Applicative (Applicative(..))
import Control.Monad (liftM, ap)
+import Control.Monad.Fail
import Position (Position)
import UNames (NameSupply)
@@ -110,6 +111,8 @@ instance Monad (PreCST e s) where
(>>=) = (+>=)
(>>) = (+>)
+instance MonadFail (PreCST e s) where
+ fail = error
-- unwrapper coercion function (EXPORTED)
--
diff --git a/c2hs/c/CParserMonad.hs b/c2hs/c/CParserMonad.hs
index 12c4ffa..fb9df09 100644
--- a/c2hs/c/CParserMonad.hs
+++ b/c2hs/c/CParserMonad.hs
@@ -56,6 +56,7 @@ module CParserMonad (
setLastToken, -- :: CToken -> P ()
) where
+import Prelude hiding (fail)
import Position (Position(..), Pos(posOf))
import Errors (interr)
import UNames (Name)
@@ -67,6 +68,7 @@ import Data.Set (Set)
import qualified Data.Set as Set (fromList, insert, member, delete)
import CTokens (CToken)
+import Control.Monad.Fail
data ParseResult a
= POk !PState a
@@ -93,6 +95,8 @@ instance Applicative P where
instance Monad P where
return = returnP
(>>=) = thenP
+
+instance MonadFail P where
fail m = getPos >>= \pos -> failP pos [m]
execParser :: P a -> String -> Position -> [Ident] -> [Name]
diff --git a/gtk2hs-buildtools.cabal b/gtk2hs-buildtools.cabal
index fc4a7d5..8b6be30 100644
--- a/gtk2hs-buildtools.cabal
+++ b/gtk2hs-buildtools.cabal
@@ -38,7 +38,7 @@ Flag ClosureSignals
-- Default: False
Library
- build-depends: base >= 4 && < 4.12,
+ build-depends: base >= 4 && < 4.13,
process, array, pretty,
filepath, random,
Cabal >= 1.24.0.0,
Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:
I think it's important, the experience is really bad any time these "special" packages need to be overridden and in my experience, introduces many strange build errors if not done exactly right, including tweaking some GHC-related variables in build phases.
I marked this as stale due to inactivity. → More info
Issue description
I want to use a different version of
gtk2hs-buildtools
. However if I simply doIt does not override all the uses of gtk2hs-buildtools.
Notably in
configuration-common.nix
(andconfiguration-nix.nix
) we can find the following lines:These are pulled in by things such as
gtk
package. It appears to me that this is what uses the gtk2hs-buildtools from non-overriden package set.Steps to reproduce
Override gtk2hs-buildtools to a different version through overrides. Depend on
gtk
Haskell package from that override package set. See both versions being pulled in.Technical details
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the results."x86_64-linux"
Linux 4.18.15, NixOS, 19.03.git.7a10601 (Koi)
yes
yes
nix-env (Nix) 2.1pre6377_954d1f4d
"nixos-17.09.3269.14f9ee66e63"
/home/shana/programming/nixpkgs