Comments (6)
What also doesn’t work: Removing time
(and other GHC-provided packages) from plan.nix
: aeson
seems to depend on it.
from haskell.nix.
Maybe https://ghc.haskell.org/trac/ghc/ticket/14889, which has a patch against hsc2hs
?
Maybe this (or some other patch) applied when building within ghc
, but it is not used when building time
exernally?
from haskell.nix.
I am experimenting with
diff --git a/builder/comp-builder.nix b/builder/comp-builder.nix
index 87cd54f..7cd0c2a 100644
--- a/builder/comp-builder.nix
+++ b/builder/comp-builder.nix
@@ -169,7 +169,8 @@ let
++ lib.optional (deadCodeElimination && stdenv.hostPlatform.isLinux) "--enable-split-sections"
++ lib.optional (static) "--enable-static"
++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) (
- map (arg: "--hsc2hs-option=" + arg) ["--cross-compile" "--via-asm"]
+ [ "--hsc2hs-option=--cross-compile" ]
+ ++ lib.optional (stdenv.hostPlatform.isWindows) "--hsc2hs-option=--via-asm"
++ lib.optional (package.buildType == "Configure") "--configure-option=--host=${stdenv.hostPlatform.config}" )
++ component.configureFlags
);
under the somewhat random assumption that musl
cross-compilation isn’t cross-compilingishly enough to need --via-asm
, and it seems I made it past building time
.
from haskell.nix.
This looks good. With this change, and the following hack(?) in the output of cabal-to-nix
:
diff --git a/nix/tttool.nix b/nix/tttool.nix
index 678f1c9..9856027 100644
--- a/nix/tttool.nix
+++ b/nix/tttool.nix
@@ -31,6 +31,13 @@
components = {
exes = {
"tttool" = {
+ configureFlags = pkgs.lib.optionals (pkgs.hostPlatform.isMusl) [
+ "--ghc-option=-static"
+ "--ghc-option=-optl=-static"
+ "--extra-lib-dirs=${pkgs.gmp6.override { withStatic = true; }}/lib"
+ "--extra-lib-dirs=${pkgs.zlib.static}/lib"
+ ];
depends = (([
(hsPkgs.base)
(hsPkgs.binary)
(to simulate --enable-executable-dynamic
which was added to cabal
only recently at haskell/cabal#5446 by nh2) it seems I can almost link it. I am now stuck because nixpkgs
does not seem to provide a static version of libtinfo
, which I have reported already at
nh2/static-haskell-nix#14
from haskell.nix.
Success!
After
~/projekte/tip-toi-reveng $ git diff nix/plan.nix
diff --git a/nix/plan.nix b/nix/plan.nix
index 4b81166..147ce08 100644
--- a/nix/plan.nix
+++ b/nix/plan.nix
@@ -8,6 +8,7 @@ hackage:
"polyparse".revision = (((hackage."polyparse")."1.12").revisions).default;
"old-time".revision = (((hackage."old-time")."1.1.0.3").revisions).default;
"haskeline".revision = (((hackage."haskeline")."0.7.4.2").revisions).default;
+ "haskeline".flags.terminfo = false;
"split".revision = (((hackage."split")."0.2.3.3").revisions).default;
"stm".revision = (((hackage."stm")."2.4.5.1").revisions).default;
"HTF".revision = (((hackage."HTF")."0.13.2.5").revisions).default;
I can build a static version of the program:
~/projekte/tip-toi-reveng $ file $(nix-build -A static-exe nix)/bin/tttool
/nix/store/sn0p4q19l3gs88bb2vd2bcdc3jm4j27y-tttool-1.8-exe-tttool-x86_64-unknown-linux-musl/bin/tttool: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
and my default.nix
ends in this pleasing derivation:
in
{ linux-exe = tttool-exe {};
windows-exe = tttool-exe { crossSystem = localLib.systems.examples.mingwW64;};
static-exe = tttool-exe { crossSystem = localLib.systems.examples.musl64;};
}
I’ll leave this open for you to assess the fix that applied to builder/comp-builder.nix
.
from haskell.nix.
@nomeata you can put all those customizations into your pkgs.nix
at
just add the following module:
{
packages.haskeline.flags.terminfo = false;
packages.tttool.configureFlags = pkgs.lib.optionals (pkgs.hostPlatform.isMusl) [
"--ghc-option=-static"
"--ghc-option=-optl=-static"
"--extra-lib-dirs=${pkgs.gmp6.override { withStatic = true; }}/lib"
"--extra-lib-dirs=${pkgs.zlib.static}/lib"
];
}
regarding the --via-asm
; I thought that was fixed in a recent hsc2hs
, but the change would work. I'll add something to input-output-hk/haskell.nix. Thanks!
from haskell.nix.
Related Issues (20)
- Unbreaking GHC-9.6 TH crashes. HOT 1
- Shells are more prescriptive about using the installed packages
- Clarify method to update stack snaphost in docs
- Cabal patches fail to apply to 3.10.3 HOT 1
- Help using extraPkgconfigMappings HOT 2
- HLS 2.7.0.0 HOT 2
- Package builds with stack, doesn't build with haskell.nix HOT 3
- Non-existent ghc-boot-9.8.2 package referenced in stackage nightly nix file HOT 3
- OS-specific conditional dependencies are excluded from the package set during cross-compilation
- Typo in `nix-tools/nix-tools/cabal2nix/Main.hs` error HOT 1
- Unexpected WARNING(s) when `compiler-nix-name = ghc96*`. HOT 1
- Can't create shell with cabal-fmt and GHC 9.10 HOT 3
- Set arch-native: False for hashable >= 1.4.5.0 HOT 2
- New git config safe.directory's default breaks support for source-repository-package HOT 4
- Cabal patches fail to apply to 3.10.3 HOT 2
- can't build ghc because recent nixpkgs lacks ghc962 HOT 6
- GHC 9.6.6 HOT 1
- Regression: Mingw-w64 runtime failure: 32 bit pseudo relocation
- Is cache.zw3rk.com down? HOT 1
- Can't update boot packages with haskell.nix that can be updated fine with stack HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from haskell.nix.