forked from cardano-foundation/cardano-wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
124 lines (112 loc) · 4.98 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
############################################################################
#
# Cardano Wallet Nix build
#
# Derivation attributes of this file can be build with "nix-build -A ..."
# Discover attribute names using tab-completion in your shell.
#
# Interesting top-level attributes:
#
# - cardano-wallet - cli executable
# - tests - attrset of test-suite executables
# - cardano-wallet-core.unit
# - cardano-wallet.integration
# - etc (layout is PACKAGE.COMPONENT)
# - checks - attrset of test-suite results
# - cardano-wallet-core.unit
# - cardano-wallet.integration
# - etc
# - benchmarks - attret of benchmark executables
# - cardano-wallet-core.db
# - cardano-wallet.latency
# - etc
# - migration-tests - tests db migrations from previous versions
# - dockerImage - tarballs of the docker images
# - shelley
# - shell - import of shell.nix
# - project.hsPkgs - a Haskell.nix package set of all packages and their dependencies
# - cardano-wallet-core.components.library
# - etc (layout is PACKAGE-NAME.components.COMPONENT-TYPE.COMPONENT-NAME)
#
# The attributes of this file are imported by the Hydra jobset and
# mapped into the layout TARGET-SYSTEM.ATTR-PATH.BUILD-SYSTEM.
# See release.nix for more info about that.
#
# Other documentation:
# https://github.com/input-output-hk/cardano-wallet/wiki/Building#nix-build
#
############################################################################
{ system ? builtins.currentSystem
, crossSystem ? null
, config ? {}
# Import pinned Nixpkgs with iohk-nix and Haskell.nix overlays
, pkgs ? import ./nix/default.nix { inherit system crossSystem config sourcesOverride; }
# Use this git revision for stamping executables
, gitrev ? pkgs.commonLib.commitIdFromGitRepoOrZero ./.git
# Use this to reference local sources rather than the niv pinned versions (see nix/default.nix)
, sourcesOverride ? {}
# GitHub PR number (as a string), set when building a Hydra PR jobset.
, pr ? null
# Bors job type (as a string), set when building a Hydra bors jobset.
, borsBuild ? null
}:
# commonLib includes iohk-nix utilities, our util.nix and nixpkgs lib.
with pkgs; with commonLib; with pkgs.haskell-nix.haskellLib;
let
src = cleanSourceWith {
src = pkgs.haskell-nix.cleanSourceHaskell { src = ./.; };
name = "cardano-wallet-src";
filter = removeSocketFilesFilter;
};
buildHaskellProject = args: import ./nix/haskell.nix ({
inherit config lib stdenv pkgs buildPackages;
inherit (pkgs) haskell-nix;
inherit src gitrev pr borsBuild;
} // args);
project = buildHaskellProject {};
profiledProject = buildHaskellProject { profiling = true; };
coveredProject = buildHaskellProject { coverage = true; };
getPackageChecks = mapAttrs (_: package: package.checks);
self = {
inherit pkgs commonLib src project profiledProject coveredProject;
inherit (project.hsPkgs.cardano-wallet-core.identifier) version;
# Cardano
inherit (project.hsPkgs.cardano-cli.components.exes) cardano-cli;
cardano-node = project.hsPkgs.cardano-node.components.exes.cardano-node // {
deployments = pkgs.cardano-node-deployments;
};
# expose db-converter, so daedalus can ship it without needing to pin a ouroborus-network rev
inherit (project.hsPkgs.ouroboros-consensus-byron.components.exes) db-converter;
# adrestia tool belt
inherit (project.hsPkgs.bech32.components.exes) bech32;
inherit (project.hsPkgs.cardano-addresses-cli.components.exes) cardano-address;
inherit (project.hsPkgs.cardano-transactions.components.exes) cardano-tx;
cardano-wallet = import ./nix/package-cardano-node.nix {
inherit pkgs gitrev;
haskellBuildUtils = haskellBuildUtils.package;
exe = project.hsPkgs.cardano-wallet.components.exes.cardano-wallet;
inherit (self) cardano-node;
};
# `tests` are the test suites which have been built.
tests = collectComponents "tests" isProjectPackage coveredProject.hsPkgs;
# `checks` are the result of executing the tests.
checks = pkgs.recurseIntoAttrs (getPackageChecks (selectProjectPackages coveredProject.hsPkgs));
# Combined project coverage report
testCoverageReport = coveredProject.projectCoverageReport;
# `benchmarks` are only built, not run.
benchmarks = collectComponents "benchmarks" isProjectPackage project.hsPkgs;
dockerImage = let
mkDockerImage = backend: exe: pkgs.callPackage ./nix/docker.nix { inherit backend exe; };
in recurseIntoAttrs (mapAttrs mkDockerImage {
shelley = self.cardano-wallet;
});
shell = import ./shell.nix { inherit pkgs; walletPackages = self; };
shell-prof = import ./shell.nix { inherit pkgs; walletPackages = self; profiling = true; };
cabalShell = import ./nix/cabal-shell.nix { inherit pkgs; walletPackages = self; };
stackShell = import ./nix/stack-shell.nix { inherit pkgs; walletPackages = self; };
# This is the ./nix/regenerate.sh script. Put it here so that it's
# built and cached on CI.
inherit stackNixRegenerate;
};
in
self