Skip to content

Commit

Permalink
Use new haskell.nix and iohk-nix
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishmack committed Jul 15, 2019
1 parent 2aee9bc commit 044688a
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 63 deletions.
11 changes: 4 additions & 7 deletions default.nix
Expand Up @@ -30,10 +30,7 @@ let
# We will instantiate the defaul-nix template with the
# nix/pkgs.nix file...
default-nix = localLib.nix-tools.default-nix ./nix/default.nix args;
inherit ((localLib.nix-tools.default-nix ./nix/plan-only.nix args).nix-tools._raw) plan-nix;

shell-nix-tools = (localLib.nix-tools.default-nix ./nix/shell-only.nix args).nix-tools;
inherit (shell-nix-tools._raw) pkgs hsPkgs nodePkgs nodejs;
inherit (default-nix.nix-tools-raw) plan-nix pkgs hsPkgs nodePkgs nodejs;
cabalSystem = builtins.replaceStrings ["-darwin"] ["-osx"] pkgs.stdenv.system;

# Use this to set the version of asterius to be booted in the shell.
Expand Down Expand Up @@ -67,18 +64,18 @@ let
nodePkgs.todomvc-common ];
shellHook = (oldAttrs.shellHook or "") + ''
unset CABAL_CONFIG
export asterius_bootdir=${cached.nix-tools._raw.asterius-boot}/boot
export asterius_bootdir=${cached.nix-tools-raw.asterius-boot}/boot
find . -name package.yaml -exec hpack "{}" \;
export asterius_datadir=$(pwd)/asterius
export binaryen_datadir=$(pwd)/binaryen
export ghc_toolkit_datadir=$(pwd)/ghc-toolkit
# export sandbox_ghc_lib_dir=$(ghc --print-libdir) # does not include `indclude` dir
export sandbox_ghc_lib_dir=$(${shell-nix-tools._raw.ghc-compiler}/bin/ghc --print-libdir)
export sandbox_ghc_lib_dir=$(${default-nix.nix-tools-raw.ghc-compiler}/bin/ghc --print-libdir)
export inline_js_datadir=$(pwd)/inline-js/inline-js
export inline_js_core_datadir=$(pwd)/inline-js/inline-js-core
export wabt_datadir=$(pwd)/wabt
export wasm_toolkit_datadir=$(pwd)/wasm-toolkit
export boot_libs_path=${shell-nix-tools._raw.ghc864.boot-libs}
export boot_libs_path=${default-nix.nix-tools-raw.ghc864.boot-libs}
mkdir -p asterius-cabal-bin
cd asterius-cabal-bin
export asterius_bindir=$(pwd)
Expand Down
49 changes: 18 additions & 31 deletions nix/default.nix
Expand Up @@ -53,32 +53,18 @@ let
../asterius/test/rtsapi/rtsapi.mjs
]);
};
# our packages
plan-nix = haskell.callCabalProjectToNix {
src = cleanSrc;
ghc = pkgs.haskell.compiler.ghc864;
index-state = "2019-06-22T00:00:00Z";
index-sha256 = "19v6bqgg886704b8palrzqiydnfjsqqkrx9k6c22kw6kffrrrmd6";
};
plan-pkgs-0 = if planOnly then {
# Hydra does not deal with IFD well. The work arounds is to build
# add a job for just the plan-nix and run it on its own to build
# and cache all the dependencies needed for the IFD to work.
# This empty plan is used instead of the real one when we just
# want the plan-nix and do not want to tirgger an IFD.
extras = hackage: { packages = {}; };
pkgs = hackage: {
compiler = {
nix-name = "ghc864";
};
packages = {}; };
}
else import "${plan-nix}";
plan-0 = haskell.callCabalProjectToNix {
src = cleanSrc;
ghc = pkgs.haskell.compiler.ghc864;
index-state = "2019-06-22T00:00:00Z";
index-sha256 = "19v6bqgg886704b8palrzqiydnfjsqqkrx9k6c22kw6kffrrrmd6";
};
# Hide libiserv from the plan because it does not exist in hackage
# TODO find a proper fix for this issue
plan-pkgs = plan-pkgs-0 // {
pkgs = hackage: let x = (plan-pkgs-0.pkgs hackage);
in x // { packages = removeAttrs x.packages [ "libiserv" ]; }; };
plan = plan-0 // {
pkgs = plan-0.pkgs // {
pkgs = hackage: let x = (plan-0.pkgs.pkgs hackage);
in x // { packages = removeAttrs x.packages [ "libiserv" ]; }; }; };

cabalPatch = pkgs.fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/haskell/cabal/pull/6055.diff";
Expand All @@ -97,11 +83,11 @@ let
# packages.cbors.patches = [ ./one.patch ];
# packages.cbors.flags.optimize-gmp = false;
#
compiler = (plan-pkgs.extras {}).compiler or
(plan-pkgs.pkgs {}).compiler;
compiler = (plan.pkgs.extras {}).compiler or
(plan.pkgs.pkgs {}).compiler;

pkgSet = haskell.mkCabalProjectPkgSet {
inherit plan-pkgs;
plan-pkgs = plan.pkgs;
# The extras allow extension or restriction of the set of
# packages we are interested in. By using the stack-pkgs.extras
# we restrict our package set to the ones provided in stack.yaml.
Expand All @@ -121,7 +107,7 @@ let
# packages.hsc2hs.components.exes.hsc2hs.doExactConfig = true;
ghc.patches = [ ./patches/ghc.patch ./patches/ghc/MR948--32bit-cross-th.patch ];
Cabal.patches = [ cabalPatch ];
} // (if planOnly then {} else {
} // {
asterius.components.tests =
pkgs.lib.mapAttrs (n: v: {
build-tools =
Expand All @@ -130,9 +116,9 @@ let
nodePkgs.parcel-bundler
nodePkgs.todomvc-app-css
nodePkgs.todomvc-common ];
}) (haskell.mkCabalProjectPkgSet {inherit plan-pkgs;})
}) (haskell.mkCabalProjectPkgSet {plan-pkgs = plan.pkgs;})
.config.hsPkgs.asterius.components.tests;
});
};
})
];
};
Expand Down Expand Up @@ -232,8 +218,9 @@ let
in
pkgSet.config.hsPkgs // {
_config = pkgSet.config;
plan-nix = plan.nix;
inherit (pkgSet.config) hsPkgs;
inherit ghc-head ghc864 plan-nix pkgs haskell nodejs nodePkgs asterius-boot;
inherit ghc-head ghc864 pkgs haskell nodejs nodePkgs asterius-boot;
ghc-compiler = pkgs.haskell.compiler.${compiler.nix-name};
ghc-boot-libs = ghc864.boot-libs;
}
8 changes: 0 additions & 8 deletions nix/plan-only.nix

This file was deleted.

7 changes: 0 additions & 7 deletions nix/shell-only.nix

This file was deleted.

6 changes: 3 additions & 3 deletions pins/haskell-nix-src.json
@@ -1,7 +1,7 @@
{
"url": "https://github.com/input-output-hk/haskell.nix",
"rev": "5db2e41ee0b25a02fd3c03d4fdd9d38c0488e707",
"date": "2019-06-24T19:45:48+12:00",
"sha256": "0ah3c81yfr5198x6icm12mqf0zasf6wn9bdh3rp7z3bmxqsid1r1",
"rev": "30c1ed2749f972284f1b0a343ba29065c784b1b3",
"date": "2019-07-15T01:19:15+12:00",
"sha256": "1rdp9ppjxh6jdwm0pjn8wsgh45ym4vsj13gappx91wch22522qdj",
"fetchSubmodules": false
}
6 changes: 3 additions & 3 deletions pins/iohk-nix-src.json
@@ -1,7 +1,7 @@
{
"url": "https://github.com/input-output-hk/iohk-nix",
"rev": "d475eee3c56063666dab3fc6b2aecef4b679963a",
"date": "2019-06-24T13:26:28+12:00",
"sha256": "0fy5k8v29s9bd4d6vpvhfg8jwhcpvdmishxac99fp9arwz19k108",
"rev": "894290551864da2c5601d75734af8b65cfa8f825",
"date": "2019-07-15T16:55:53+12:00",
"sha256": "0kvlfsgy67y90rw5nhq53v26iv447zajgyv79ydmxf6q7afzwnd5",
"fetchSubmodules": false
}
8 changes: 4 additions & 4 deletions pins/nixpkgs-src.json
@@ -1,7 +1,7 @@
{
"url": "https://github.com/input-output-hk/nixpkgs",
"rev": "4d29a3148c22967a440badbe7168f55efde4fa8f",
"date": "2019-05-16T16:13:21+08:00",
"sha256": "0lcibrzxdhmz4dk8d39vnhrwjvqf1k8djwwy7pvkg3bq23sw9mgd",
"url": "https://github.com/NixOS/nixpkgs",
"rev": "fe797e0adefc0ff50867a9898d445aee0d4e8f49",
"date": "2019-07-01T14:45:25+02:00",
"sha256": "0ddhhfh87bl165j8jxscyq9bzzvykqz1f1r00nad0g6c7b59rifz",
"fetchSubmodules": false
}

0 comments on commit 044688a

Please sign in to comment.