Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
[CAD-2169] add second nix build wth testing-mode flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ksaric authored and jbgi committed Nov 2, 2020
1 parent 9221cd3 commit 88cd6ec
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 16 deletions.
6 changes: 4 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ let
};

packages = {
inherit haskellPackages scripts smash-exe;
inherit haskellPackages scripts smash-exe smash-exe-testing;
inherit (haskellPackages.smash.identifier) version;

# `tests` are the test suites which have been built.
tests = collectComponents' "tests" haskellPackages;

libs = collectComponents' "library" haskellPackages;

exes = collectComponents' "exes" haskellPackages;
exes = lib.recursiveUpdate (collectComponents' "exes" haskellPackages) {
smash = { inherit smash-exe-testing; };
};

checks = recurseIntoAttrs {
# `checks.tests` collect results of executing the tests:
Expand Down
24 changes: 12 additions & 12 deletions nix/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,24 @@
, buildPackages
, config ? {}
# GHC attribute name
, compiler ? config.haskellNix.compiler or "ghc865"
, compiler
# Source root directory
, src
# Enable profiling
, profiling ? config.haskellNix.profiling or false
, projectPackagesNames
# Disable basic auth by default:
, flags ? [ "disable-basic-auth" ]
}:
let

src = haskell-nix.haskellLib.cleanGit {
name = "smash-src";
src = ../.;
};

projectPackages = lib.attrNames (haskell-nix.haskellLib.selectProjectPackages
(haskell-nix.cabalProject { inherit src; }));

# This creates the Haskell package set.
# https://input-output-hk.github.io/haskell.nix/user-guide/projects/
pkgSet = haskell-nix.cabalProject {
inherit src;
compiler-nix-name = compiler;
modules = [

# Allow reinstallation of Win32
{ nonReinstallablePkgs =
[ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base"
Expand All @@ -44,12 +42,14 @@ let
];
}
{
# Disable basic auth:
packages.smash.flags.disable-basic-auth = true;
# Set flags
packages = lib.genAttrs projectPackagesNames (_: {
flags = lib.genAttrs flags (_: true);
});
}
# TODO: Compile all local packages with -Werror:
#{
# packages = lib.genAttrs projectPackages
# packages = lib.genAttrs projectPackagesNames
# (name: { configureFlags = [ "--ghc-option=-Werror" ]; });
#}
];
Expand Down
19 changes: 18 additions & 1 deletion nix/pkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,30 @@
pkgs: _: with pkgs;
let
compiler = config.haskellNix.compiler or "ghc865";
src = haskell-nix.haskellLib.cleanGit {
name = "smash-src";
src = ../.;
};
projectPackagesNames = lib.attrNames (haskell-nix.haskellLib.selectProjectPackages
(haskell-nix.cabalProject { inherit src; compiler-nix-name = compiler; }));
in {

inherit projectPackagesNames;


smashHaskellPackages = callPackage ./haskell.nix {
inherit compiler;
inherit compiler src projectPackagesNames;
};

smashTestingHaskellPackages = callPackage ./haskell.nix {
inherit compiler src projectPackagesNames;
flags = [ "testing-mode" ];
};

# Grab the executable component of our package.
inherit (smashHaskellPackages.smash.components.exes)
smash-exe;

smash-exe-testing = smashTestingHaskellPackages.smash.components.exes.smash-exe;

}
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let
shell = smashHaskellPackages.shellFor {
name = "cabal-dev-shell";

packages = ps: lib.attrValues (haskell-nix.haskellLib.selectProjectPackages ps);
packages = ps: attrValues (lib.getAttrs projectPackagesNames ps);

# These programs will be available inside the nix-shell.
buildInputs = with haskellPackages; [
Expand Down

0 comments on commit 88cd6ec

Please sign in to comment.