Skip to content

Commit

Permalink
Successfully build tttool statically using musl
Browse files Browse the repository at this point in the history
requires a patched `haskell.nix` due to
input-output-hk/haskell.nix#86
and disabled `terminfo` support in `haskelline` due to
nh2/static-haskell-nix#14

But it seems to work!
  • Loading branch information
nomeata committed Mar 8, 2019
1 parent aff912d commit 416fb8c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ let
tttool-exe = args:
let
pkgs = localLib.iohkNix.getPkgs args;
haskell = localLib.nix-tools.haskell { inherit pkgs; };
haskellLib = pkgs.fetchFromGitHub {
owner = "nomeata";
repo = "haskell.nix";
rev = "fd36e3f8256694884cebbe72d63177358ab15b0e";
sha256 = "0faxzn7labgf4jc75rrmnzq20bap2xpfv3paxg6fcfwwydcnnacs";
fetchSubmodules = false;
name = "haskell-lib-source";
};
haskell = import haskellLib { inherit pkgs; };
nix-tools = import ./pkgs.nix { inherit haskell pkgs; };
in
nix-tools.tttool.components.exes.tttool;
Expand Down
1 change: 1 addition & 0 deletions nix/plan.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions nix/tttool.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
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)
Expand Down

0 comments on commit 416fb8c

Please sign in to comment.