-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
394 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,51 @@ | ||
{ system ? builtins.currentSystem | ||
, crossSystem ? null | ||
# allows to cutomize haskellNix (ghc and profiling, see ./nix/haskell.nix) | ||
# and scripts (see ./nix/scripts.nix): | ||
, config ? {} | ||
# allows to override dependencies of the project without modifications, | ||
# eg. to test build against local checkout of nixpkgs and iohk-nix: | ||
# nix build -f default.nix cardano-node --arg sourcesOverride '{ | ||
# iohk-nix = ../iohk-nix; | ||
# }' | ||
, sourcesOverride ? {} | ||
, profiling ? false | ||
, commonLib ? import ./lib.nix { inherit system crossSystem config profiling; } | ||
, pkgs ? commonLib.pkgs | ||
, customConfig ? {} | ||
, interactive ? false | ||
, gitrev ? commonLib.iohkNix.commitIdFromGitRepoOrZero ./.git | ||
, withHoogle ? true | ||
# pinned version of nixpkgs augmented with overlays (iohk-nix and our packages). | ||
, pkgs ? import ./nix { inherit system crossSystem config sourcesOverride; } | ||
, gitrev ? pkgs.iohkNix.commitIdFromGitRepoOrZero ./.git | ||
}: | ||
|
||
with pkgs; with commonLib; | ||
let | ||
lib = commonLib.pkgs.lib; | ||
inherit (commonLib) environments haskellPackages niv; | ||
cardano-node = haskellPackages.cardano-node.components.exes.cardano-node; | ||
|
||
scripts = commonLib.pkgs.callPackage ./nix/scripts.nix { | ||
inherit commonLib customConfig; | ||
}; | ||
# we are only intersted in listing the project packages | ||
haskellPackages = selectProjectPackages cardanoNodeHaskellPackages; | ||
|
||
scripts = callPackage ./nix/scripts.nix {}; | ||
# NixOS tests run a proxy and validate it listens | ||
nixosTests = import ./nix/nixos/tests { | ||
inherit (commonLib) pkgs; | ||
inherit commonLib interactive; | ||
inherit pkgs; | ||
}; | ||
|
||
# we are only intersted in listing the project packages | ||
projectHaskellPackages = commonLib.selectProjectPackages haskellPackages; | ||
|
||
self = with commonLib; { | ||
inherit scripts nixosTests environments cardano-node; | ||
self = { | ||
inherit haskellPackages scripts nixosTests environments check-hydra; | ||
|
||
haskellPackages = projectHaskellPackages; | ||
inherit (iohkNix) check-hydra; | ||
inherit (haskellPackages.cardano-node.identifier) version; | ||
# Grab the executable component of our package. | ||
inherit (haskellPackages.cardano-node.components.exes) | ||
cardano-node; | ||
|
||
# `tests` are the test suites which have been built. | ||
tests = collectComponents' "tests" projectHaskellPackages; | ||
tests = collectComponents' "tests" haskellPackages; | ||
# `benchmarks` (only built, not run). | ||
benchmarks = collectComponents' "benchmarks" projectHaskellPackages; | ||
# `checks` collect results of executing the benchmarks and tests: | ||
benchmarks = collectComponents' "benchmarks" haskellPackages; | ||
|
||
checks = { | ||
benchmarks = collectChecks self.benchmarks; | ||
tests = collectChecks self.tests; | ||
# `checks.tests` collect results of executing the tests: | ||
tests = collectChecks haskellPackages; | ||
} // { recurseForDerivations = true; }; | ||
|
||
shell = haskellPackages.shellFor { | ||
|
||
packages = ps: with ps; [ | ||
ps.cardano-node | ||
ps.cardano-config | ||
# in theory we should only have the above two packages (or better, they should be auto-detected), | ||
# but due to source-repository-package declarations being considered as local packages by cabal, we need the following packages as well. | ||
# cf. https://github.com/haskell/cabal/issues/6249 and https://github.com/haskell/cabal/issues/5444 | ||
ps.cardano-sl-x509 | ||
ps.ekg-prometheus-adapter | ||
ps.ouroboros-consensus | ||
ps.ouroboros-network | ||
]; | ||
|
||
# Builds a Hoogle documentation index of all dependencies, | ||
# and provides a "hoogle" command to search the index. | ||
inherit withHoogle; | ||
|
||
# You might want some extra tools in the shell (optional). | ||
buildInputs = with pkgs; [ | ||
cabal-install | ||
ghcid | ||
hlint | ||
pkgs.haskellPackages.weeder | ||
nix | ||
niv | ||
pkgconfig | ||
sqlite-interactive | ||
tmux | ||
git | ||
]; | ||
|
||
# Prevents cabal from choosing alternate plans, so that | ||
# *all* dependencies are provided by Nix. | ||
exactDeps = true; | ||
shell = import ./shell.nix { | ||
inherit pkgs; | ||
withHoogle = true; | ||
}; | ||
|
||
}; | ||
|
||
}; | ||
in self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ system ? builtins.currentSystem | ||
, crossSystem ? null | ||
, config ? {} | ||
, sourcesOverride ? {} | ||
}: | ||
let | ||
# use default stable nixpkgs from iohk-nix instead of our own: | ||
sources = removeAttrs (import ./sources.nix) [ "nixpkgs" ] | ||
// sourcesOverride; | ||
|
||
# for inclusion in pkgs: | ||
nixpkgsOverlays = [ | ||
(pkgs: _: with pkgs; { | ||
|
||
# mix of pkgs.lib with iohk-nix utils and our own: | ||
commonLib = lib // iohkNix // iohkNix.cardanoLib // | ||
import ./util.nix { inherit haskell-nix; }; | ||
|
||
svcLib = import ./svclib.nix { inherit pkgs; }; | ||
}) | ||
# Our haskell-nix-ified cabal project: | ||
(import ./pkgs.nix) | ||
]; | ||
|
||
# IOHK pkgs that include haskell-nix overlays, using our sources as override: | ||
in (import sources.iohk-nix { | ||
inherit system crossSystem config nixpkgsOverlays; | ||
sourcesOverride = sources; | ||
}).pkgs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
############################################################################ | ||
# Builds Haskell packages with Haskell.nix | ||
############################################################################ | ||
{ lib | ||
, stdenv | ||
, haskell-nix | ||
, buildPackages | ||
, config ? {} | ||
# GHC attribute name | ||
, compiler ? config.haskellNix.compiler or "ghc865" | ||
# Enable profiling | ||
, profiling ? config.haskellNix.profiling or false | ||
}: | ||
let | ||
# GHC attribute name | ||
compiler = config.cardanoNode.compiler or "ghc865"; | ||
# Enable profiling | ||
profiling = config.cardanoNode.profiling or false; | ||
|
||
# This creates the Haskell package set. | ||
# https://input-output-hk.github.io/haskell.nix/user-guide/projects/ | ||
pkgSet = haskell-nix.cabalProject { | ||
src = haskell-nix.haskellLib.cleanGit { src = ../.; }; | ||
ghc = buildPackages.haskell-nix.compiler.${compiler}; | ||
modules = [ | ||
|
||
# Allow reinstallation of Win32 | ||
{ nonReinstallablePkgs = | ||
[ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base" | ||
"deepseq" "array" "ghc-boot-th" "pretty" "template-haskell" | ||
# ghcjs custom packages | ||
"ghcjs-prim" "ghcjs-th" | ||
"ghc-boot" | ||
"ghc" "array" "binary" "bytestring" "containers" | ||
"filepath" "ghc-boot" "ghc-compact" "ghc-prim" | ||
# "ghci" "haskeline" | ||
"hpc" | ||
"mtl" "parsec" "text" "transformers" | ||
"xhtml" | ||
# "stm" "terminfo" | ||
]; | ||
} | ||
{ | ||
# Packages we wish to ignore version bounds of. | ||
# This is similar to jailbreakCabal, however it | ||
# does not require any messing with cabal files. | ||
packages.katip.doExactConfig = true; | ||
|
||
# split data output for ekg to reduce closure size | ||
packages.ekg.components.library.enableSeparateDataOutput = true; | ||
packages.cardano-node.configureFlags = [ "--ghc-option=-Werror" ]; | ||
packages.cardano-config.configureFlags = [ "--ghc-option=-Werror" ]; | ||
enableLibraryProfiling = profiling; | ||
} | ||
(lib.optionalAttrs stdenv.hostPlatform.isWindows { | ||
# Disable cabal-doctest tests by turning off custom setups | ||
packages.comonad.package.buildType = lib.mkForce "Simple"; | ||
packages.distributive.package.buildType = lib.mkForce "Simple"; | ||
packages.lens.package.buildType = lib.mkForce "Simple"; | ||
packages.nonempty-vector.package.buildType = lib.mkForce "Simple"; | ||
packages.semigroupoids.package.buildType = lib.mkForce "Simple"; | ||
|
||
# Make sure we use a buildPackages version of happy | ||
packages.pretty-show.components.library.build-tools = [ buildPackages.haskell-nix.haskellPackages.happy ]; | ||
|
||
# Remove hsc2hs build-tool dependencies (suitable version will be available as part of the ghc derivation) | ||
packages.Win32.components.library.build-tools = lib.mkForce []; | ||
packages.terminal-size.components.library.build-tools = lib.mkForce []; | ||
packages.network.components.library.build-tools = lib.mkForce []; | ||
}) | ||
]; | ||
# TODO add flags to packages (like cs-ledger) so we can turn off tests that will | ||
# not build for windows on a per package bases (rather than using --disable-tests). | ||
configureArgs = lib.optionalString stdenv.hostPlatform.isWindows "--disable-tests"; | ||
}; | ||
in | ||
pkgSet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.