Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit b9f9ca5

Browse files
jbgiksaric
authored andcommitted
Use new shellFor function to provide build env. (#174)
* Use new shellFor function to provide build env. Only build dependencies, allow pure stack build. * Add stack-hpc-coveralls to default nix-shell.
1 parent 5715f04 commit b9f9ca5

File tree

5 files changed

+27
-14
lines changed

5 files changed

+27
-14
lines changed

default.nix

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,31 @@ in
4141
# parameterize this file when targetting different
4242
# hosts.
4343
{ system ? builtins.currentSystem
44+
, crossSystem ? null
4445
, config ? {}
45-
, pkgs ? commonLib.getPkgs { inherit config system; }
46-
, ... }@args:
47-
# We will instantiate the default-nix template with the
48-
# nix/pkgs.nix file...
49-
commonLib.nix-tools.default-nix ./nix/pkgs.nix args
50-
# ... and add additional non-haskell packages we want to build on CI:
51-
// {
46+
, pkgs ? commonLib.getPkgs { inherit config crossSystem system; }
47+
, withHoogle ? true
48+
}:
49+
let
50+
# We will instantiate the default-nix template with the
51+
# nix/pkgs.nix file...
52+
defaultNix = commonLib.nix-tools.default-nix ./nix/pkgs.nix {
53+
inherit system crossSystem config pkgs;
54+
};
55+
in defaultNix // {
56+
# ... and add additional packages we want to build on CI:
57+
58+
env = defaultNix.nix-tools.shellFor {
59+
inherit withHoogle;
60+
# env will provide the dependencies of cardano-shell
61+
packages = ps: with ps; [ cardano-shell ];
62+
# This adds git to the shell, which is used by stack.
63+
buildInputs = with pkgs; [ git stack commonLib.stack-hpc-coveralls ];
64+
};
5265

5366
runCoveralls = pkgs.stdenv.mkDerivation {
5467
name = "run-coveralls";
55-
buildInputs = with pkgs; [ haskellPackages.stack-hpc-coveralls stack ];
68+
buildInputs = with pkgs; [ commonLib.stack-hpc-coveralls stack ];
5669
shellHook = ''
5770
echo '~~~ stack test'
5871
stack test --coverage

nix/iohk-nix-src.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"url": "https://github.com/input-output-hk/iohk-nix",
3-
"rev": "5040e0192871203251ed404edb3c9259c18bc7e1",
4-
"date": "2019-05-20T19:03:56-03:00",
5-
"sha256": "1ah1njfj906068g0z10x5ldphcx4l1dx7y026vhmqyjhyqgml88q",
3+
"rev": "8a7faeddf108515a8d64cb3dcf552bbd432865a3",
4+
"date": "2019-05-31T03:32:45+00:00",
5+
"sha256": "0cjsnzfnyhbvjvw9lk2z6bznjnpq452d629319km29yvqqg2n9yk",
66
"fetchSubmodules": false
77
}

shell.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
let
22
localPkgs = import ./. { };
3-
mainShell = localPkgs.nix-tools.libs.cardano-shell;
3+
mainShell = localPkgs.env;
44
in mainShell // {
55
inherit (localPkgs) runCoveralls;
66
}

stack-shell.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(import ./. { withHoogle = false; }).env

stack.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,4 @@ extra-deps:
9696

9797
nix:
9898
enable: true
99-
pure: false
100-
shell-file: shell.nix
99+
shell-file: stack-shell.nix

0 commit comments

Comments
 (0)