-
Notifications
You must be signed in to change notification settings - Fork 248
Alex and Happy in more recent versions start to break #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This should be fixed with input-output-hk/iohk-nix#30 which includes the patch to haskell/cabal#5862. |
https://github.com/simonmar/alex/blob/75d0ab55f6b056049c8d80e47c8b93674a704128/src/Main.hs#L149 makes me think it is that Cabal bug - |
Ok, I think the problem is changing If I remove my |
A bit more debugging - I think anything with |
diff --git a/builder/default.nix b/builder/default.nix
index e231cab..1009ef5 100644
--- a/builder/default.nix
+++ b/builder/default.nix
@@ -57,7 +57,7 @@ in {
# Build a Haskell package from its config.
# TODO: this pkgs is the adjusted pkgs, but pkgs.pkgs is unadjusted
build-package = haskellLib.weakCallPackage pkgs ./hspkg-builder.nix {
- inherit haskellLib ghc buildGHC comp-builder setup-builder;
+ inherit haskellLib ghc buildGHC comp-builder setup-builder makeSetupConfigFiles;
};
inherit shellFor;
diff --git a/builder/hspkg-builder.nix b/builder/hspkg-builder.nix
index 922902e..5c169af 100644
--- a/builder/hspkg-builder.nix
+++ b/builder/hspkg-builder.nix
@@ -1,4 +1,4 @@
-{ pkgs, buildPackages, stdenv, lib, haskellLib, ghc, buildGHC, fetchurl, runCommand, comp-builder, setup-builder }:
+{ pkgs, buildPackages, stdenv, lib, haskellLib, ghc, buildGHC, fetchurl, runCommand, comp-builder, setup-builder, makeSetupConfigFiles }:
{ flags
@@ -12,6 +12,7 @@
, revision
, revisionSha256
, patches
+, hardeningDisable
, shellHook
@@ -30,22 +31,40 @@ let
import Distribution.Simple
main = defaultMain
'';
- defaultSetup = buildPackages.runCommand "default-Setup" { nativeBuildInputs = [buildGHC]; } ''
- cat ${defaultSetupSrc} > Setup.hs
- mkdir -p $out/bin
- ${buildGHC.targetPrefix}ghc Setup.hs --make -o $out/bin/Setup
- '';
+ defaultConfig = makeSetupConfigFiles {
+ inherit (package) identifier;
+ inherit (config) flags;
+ fullName = "${name}-setup";
+ component = {
+ depends = [];
+ libs = [];
+ frameworks = [];
+ doExactConfig = false;
+ };
+ };
+ defaultSetup =
+ buildPackages.runCommand
+ "default-Setup"
+ { nativeBuildInputs = [buildGHC];
+ CABAL_CONFIG = defaultConfig + /cabal.config;
+ }
+ ''
+ cat ${defaultSetupSrc} > Setup.hs
+ mkdir -p $out/bin
+ ${buildGHC.targetPrefix}ghc Setup.hs --make -o $out/bin/Setup
+ '';
setup = if package.buildType == "Simple"
then defaultSetup
else setup-builder {
setup-depends = package.setup-depends;
inherit package name src flags;
+ postUnpack = config.postUnpack;
};
buildComp = componentId: component: comp-builder {
inherit componentId component package name src flags setup cabalFile cabal-generator patches revision
- shellHook
+ shellHook hardeningDisable
;
}; Appears to fix this. Will test more and open a PR if so. |
Great analysis @ocharles!
Oh! yes of course, that makes sense! Guess we'll have to always build |
What I've done so far is taken the above patch, and only for
so at least only |
@ocharles I'm unable to evaluate with your patch:
This issue has been open for some time; is there a plan to make this work? Being unable to use any package that depends on Happy or Alex is a pretty serious blocker... |
@ttuegel I'll try and dig my experimental work out and see what PRs I can submit. I do have a few local fixes. |
To add to this issue: I'm running into a very similar problem when trying to compile the
However, the binary is located at I applied the following changes to haskell.nix: 7797c05...considerate:master and modified the
Building |
I haven't tidied up my work into PRs yet, but the diff is master...circuithub:master. Perhaps try with the |
@ocharles Thank you for preparing this diff. Unfortunately I'm running into the same issue with your work as well. minimal.nix: { pkgs ? import <nixpkgs> {} }:
let
haskell = import (builtins.fetchTarball https://github.com/circuithub/haskell.nix/archive/master.tar.gz) { inherit pkgs; };
pkgSet = haskell.mkStackPkgSet {
stack-pkgs = {
extras = hackage:
{
packages = {
};
};
resolver = "lts-13.26";
};
pkg-def-extras = [
(hackage: {
hsc2hs = hackage.hsc2hs."0.68.4".revisions.default;
})
];
modules = [
{ packages.pretty-show.package.setup-depends = [pkgSet.config.hsPkgs.Cabal]; }
];
};
in
pkgSet.config.hsPkgs Running with
|
I realized that I needed to apply the patch to the Cabal package linked in the above cabal issue as well (haskell/cabal#5862). After applying that patch, I can now build pretty-show. 😄 For reference if someone else runs into this issue this is now the updated version: minimal.nix: { pkgs ? import <nixpkgs> {} }:
let
haskell = import (builtins.fetchTarball https://github.com/circuithub/haskell.nix/archive/master.tar.gz) { inherit pkgs; };
pkgSet = haskell.mkStackPkgSet {
stack-pkgs = {
extras = hackage:
{
packages = {
};
};
resolver = "lts-13.26";
};
pkg-def-extras = [
(hackage: {
hsc2hs = hackage.hsc2hs."0.68.4".revisions.default;
})
];
modules = [
{ packages.Cabal.patches = [./cabal.patch]; }
{ packages.happy.package.setup-depends = [pkgSet.config.hsPkgs.Cabal]; }
{ packages.pretty-show.package.setup-depends = [pkgSet.config.hsPkgs.Cabal]; }
];
};
in
pkgSet.config.hsPkgs cabal.patch: diff --git a/Distribution/Simple/Build/PathsModule.hs b/Distribution/Simple/Build/PathsModule.hs
index f6a203874..2aa406f74 100644
--- a/Distribution/Simple/Build/PathsModule.hs
+++ b/Distribution/Simple/Build/PathsModule.hs
@@ -192,10 +192,14 @@ generate pkg_descr lbi clbi =
bindir = flat_bindir,
libdir = flat_libdir,
dynlibdir = flat_dynlibdir,
- datadir = flat_datadir,
libexecdir = flat_libexecdir,
sysconfdir = flat_sysconfdir
} = absoluteComponentInstallDirs pkg_descr lbi cid NoCopyDest
+
+ InstallDirs {
+ datadir = flat_datadir
+ } = absoluteInstallDirs pkg_descr lbi NoCopyDest
+
InstallDirs {
bindir = flat_bindirrel,
libdir = flat_libdirrel, Thank you for digging into this and solving this issue. |
@considerate I was stumped about the Cabal patch, too. Thanks for posting your resolution! 🎉 |
I am trying to package lambdabot with haskell.nix and got it to run.
Final default.nix: { pkgs ? import <nixpkgs> {} }:
# default.nix
let
# Import the Haskell.nix library,
haskell = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) { inherit pkgs; };
# Import the file you will create in the stack-to-nix or cabal-to-nix step.
my-pkgs = import ./pkgs.nix;
# Cabal projects use this:
pkgSet = haskell.mkCabalProjectPkgSet {
plan-pkgs = my-pkgs;
pkg-def-extras = [];
modules = [
{ nonReinstallablePkgs =
[ "ghc-boot" "binary" "bytestring" "filepath" "directory" "containers" "time" "unix" "Win32"
"ghci" "hpc" "process" "terminfo" "transformers" "mtl" "parsec" "text"
];
}
{ packages.Cabal.patches = [./Cabal.patch]; }
{ packages.happy.package.setup-depends = [pkgSet.config.hsPkgs.Cabal]; }
{ packages.haskell.src.exts.package.setup-depends = [pkgSet.config.hsPkgs.Cabal]; }
];
};
in pkgSet.config.hsPkgs // { _config = pkgSet.config; } Would be glad to document that somewhere, but I dont know what the best location would be. |
I don't think this is still needed. |
This was upstreamed in Cabal 3.0.0.0 and GHC 8.8.4 shiped Cabal 3.0.1.0 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Specifically we see messages like:
There seems to be some mismatch between paths nix generates and cabal expects.
The text was updated successfully, but these errors were encountered: