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

Commit 5938d2f

Browse files
authored
Merge pull request #3761 from input-output-hk/devops-1083-nix-cleanup
[DEVOPS-1083] Nix documentation and cleanup part II
2 parents 5118c5d + fcc489c commit 5938d2f

File tree

3 files changed

+45
-11
lines changed

3 files changed

+45
-11
lines changed

default.nix

+31-7
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
# - lib.nix - the localLib common functions.
3737
# - nix/* - other nix code modules used by this file.
3838
#
39+
# See also:
40+
# - docs/how-to/build-cardano-sl-and-daedalus-from-source-code.md
41+
# - docs/nix.md
42+
#
3943
########################################################################
4044

4145
let
@@ -237,12 +241,7 @@ let
237241
};
238242

239243
# Tool for generating ./pkgs/default.nix
240-
stack2nix = self.callPackage (pkgs.fetchFromGitHub {
241-
owner = "avieth";
242-
repo = "stack2nix";
243-
rev = "c51db2d31892f7c4e7ff6acebe4504f788c56dca";
244-
sha256 = "10jcj33sxpq18gxf3zcck5i09b2y4jm6qjggqdlwd9ss86wg3ksb";
245-
}) { };
244+
stack2nix = self.callPackage ./nix/stack2nix.nix { };
246245

247246
validateJson = self.callPackage ./tools/src/validate-json {};
248247

@@ -255,7 +254,32 @@ let
255254

256255
inherit (self.haskellPackages.cardano-sl) version;
257256
inherit gitrev;
258-
});
257+
}
258+
# fixme: Temporary fix for hydra evaluation
259+
// { inherit (self.cardanoPackages)
260+
cardano-sl
261+
cardano-sl-auxx
262+
cardano-sl-chain
263+
cardano-sl-cluster
264+
cardano-sl-core
265+
cardano-sl-crypto
266+
cardano-sl-db
267+
cardano-sl-explorer
268+
cardano-sl-explorer-frontend
269+
cardano-sl-explorer-static
270+
cardano-sl-generator
271+
cardano-sl-infra
272+
cardano-sl-networking
273+
cardano-sl-node-static
274+
cardano-sl-tools
275+
cardano-sl-tools-post-mortem
276+
cardano-sl-util
277+
cardano-sl-wallet
278+
cardano-sl-wallet-new
279+
cardano-sl-x509
280+
cardano-report-server
281+
cardano-report-server-static; }
282+
);
259283

260284
in
261285
# The top-level package set

lib.nix

+13-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ let
99
# applied to the given args.
1010
importPkgs = args: import fetchNixPkgs ({ overlays = [ (import ./nix/overlays/jemalloc.nix) ]; } // args);
1111

12+
# Gets the value of an environment variable, with a default if it's
13+
# unset or empty.
1214
maybeEnv = env: default:
1315
let
1416
result = builtins.getEnv env;
@@ -79,9 +81,16 @@ in lib // (rec {
7981

8082
# Generates an attrset for the three cardano-sl networks by applying
8183
# the given function to each environment.
82-
forEnvironments = f: lib.mapAttrs'
83-
(name: env: lib.nameValuePair name (f (env // { environment = name; }))) # fixme: simplify
84-
(lib.filterAttrs (name: env: !env.private) environments);
84+
#
85+
# Example:
86+
# forEnvironments ({ environment, confKey, ... }: "key for ${environment} is ${confKey}")
87+
# => { demo = "key for demo is dev";
88+
# mainnet = "key for mainnet is mainnet_full";
89+
# staging = "key for staging is mainnet_dryrun_full";
90+
# testnet = "key for testnet is testnet_full"; }
91+
forEnvironments = f: lib.mapAttrs
92+
(name: env: f (env // { environment = name; }))
93+
environments;
8594

8695
runHaskell = name: hspkgs: deps: env: code: let
8796
ghc = hspkgs.ghcWithPackages deps;
@@ -93,6 +102,7 @@ in lib // (rec {
93102
${builtBinary}/bin/$name
94103
'';
95104

105+
# Overrides the lib.commitIdFromGitRepo function in nixpkgs
96106
commitIdFromGitRepo = import ./nix/commit-id.nix { inherit lib; };
97107

98108
# Plucks all the cardano-sl packages from the haskellPackages set,

scripts/test/acceptance/default.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let
1818
allDeps = demoClusterDeps ++ cardanoDeps;
1919

2020
wallet = connect {
21-
inherit environment;
21+
inherit environment stateDir;
2222

2323
# This will limit heap size to 1GB, along with the usual RTS options.
2424
ghcRuntimeArgs = "-N2 -qg -A1m -I0 -T -M1G";

0 commit comments

Comments
 (0)