Skip to content

Commit c5ba59a

Browse files
committed
wb | do not pass around both pkgs and lib
1 parent 8d4813e commit c5ba59a

File tree

10 files changed

+31
-32
lines changed

10 files changed

+31
-32
lines changed

nix/pkgs.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let
88
inherit (prev) customConfig;
99
# Parametrized helper entrypoint for the workbench development environment.
1010
workbench = import ./workbench
11-
{ inherit pkgs lib;
11+
{ inherit pkgs;
1212
haskellProject = final.cardanoNodeProject;
1313
}
1414
;

nix/workbench/backend/nomad-job.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# To make it easier to improve and debug the almighty workbench!
55
################################################################################
66
{ pkgs
7-
, lib
87
, stateDir
98
, profileBundle
109
, generatorTaskName
@@ -15,6 +14,8 @@
1514

1615
let
1716

17+
inherit (pkgs) lib;
18+
1819
profile = profileBundle.profile.value;
1920

2021
# Filesystem
@@ -737,7 +738,7 @@ let
737738
destination = "local/${task_supervisord_conf}";
738739
data = escapeTemplate (
739740
import ./supervisor-conf.nix
740-
{ inherit pkgs lib stateDir;
741+
{ inherit pkgs stateDir;
741742
inherit profile;
742743
profiling = "none";
743744
# Include only this taks' node

nix/workbench/backend/nomad.nix

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{ pkgs
2-
, lib
32
, haskellProject
43
, stateDir
54
, subBackendName
65
, ...
76
}:
87
let
98

9+
inherit (pkgs) lib;
10+
1011
# Backend-specific Nix bits:
1112
materialise-profile = { profileBundle }:
1213
# Intermediate / workbench-adhoc container specifications
@@ -192,15 +193,15 @@ let
192193
exec = {
193194
# TODO: oneTracerPerGroup
194195
oneTracerPerCluster = import ./nomad-job.nix
195-
{ inherit pkgs lib stateDir;
196+
{ inherit pkgs stateDir;
196197
inherit profileBundle;
197198
inherit generatorTaskName;
198199
inherit installables;
199200
oneTracerPerNode = false;
200201
withSsh = false;
201202
};
202203
oneTracerPerNode = import ./nomad-job.nix
203-
{ inherit pkgs lib stateDir;
204+
{ inherit pkgs stateDir;
204205
inherit profileBundle;
205206
inherit generatorTaskName;
206207
inherit installables;
@@ -215,15 +216,15 @@ let
215216
# Always "oneTracerPerNode"
216217
# TODO: oneTracerPerCluster and oneTracerPerGroup
217218
nomadExec = import ./nomad-job.nix
218-
{ inherit pkgs lib stateDir;
219+
{ inherit pkgs stateDir;
219220
inherit profileBundle;
220221
inherit generatorTaskName;
221222
inherit installables;
222223
oneTracerPerNode = true;
223224
withSsh = false;
224225
};
225226
ssh = import ./nomad-job.nix
226-
{ inherit pkgs lib stateDir;
227+
{ inherit pkgs stateDir;
227228
inherit profileBundle;
228229
inherit generatorTaskName;
229230
inherit installables;

nix/workbench/backend/nomad/cloud.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{ pkgs
2-
, lib
32
, haskellProject
43
, stateDir
54
, basePort # ignored, just passed to the runner (unlike `supervisor.nix`).
@@ -40,7 +39,7 @@ let
4039
# Build a Nomad Job specification for this Nomad "sub-backend".
4140
materialise-profile =
4241
let params = {
43-
inherit pkgs lib;
42+
inherit pkgs;
4443
inherit haskellProject;
4544
inherit stateDir;
4645
subBackendName = "cloud";

nix/workbench/backend/nomad/exec.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{ pkgs
2-
, lib
32
, haskellProject
43
, stateDir
54
, basePort # ignored, just passed to the runner (unlike `supervisor.nix`).
@@ -38,7 +37,7 @@ let
3837
# Build a Nomad Job specification for this Nomad "sub-backend".
3938
materialise-profile =
4039
let params = {
41-
inherit pkgs lib;
40+
inherit pkgs;
4241
inherit haskellProject;
4342
inherit stateDir;
4443
subBackendName = "exec";

nix/workbench/backend/runner.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs, lib
1+
{ pkgs
22
## The binaries/scripts to use when calling the workbench.
33
, haskellProject
44
, workbench # The derivation.
@@ -56,7 +56,7 @@ let
5656
fi
5757
export CARDANO_NODE_SOCKET_PATH=${stateDir}/node-0/node.socket
5858
''
59-
+ lib.optionalString (profileBundle.profile.value.scenario == "chainsync") (
59+
+ pkgs.lib.optionalString (profileBundle.profile.value.scenario == "chainsync") (
6060
let cardano-mainnet-mirror =
6161
# "nix" branch last commit 819488be9eabbba6aaa7c931559bc584d8071e3d
6262
__getFlake "github:input-output-hk/cardano-mainnet-mirror/nix";

nix/workbench/backend/supervisor-conf.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{ pkgs
2-
, lib
32
, stateDir
43
, profile
54
, profiling
@@ -11,9 +10,10 @@
1110
, inetHttpServerPort ? null
1211
}:
1312

14-
with lib;
15-
1613
let
14+
15+
inherit (pkgs) lib;
16+
1717
# The prefix for every "[program:X] command=sh start.sh" because `supervisord`
1818
# may run in the most unexpected places where we can't asume what is or isn't
1919
# included in $PATH. Just make sure pkgs.bashInteractive is in the nix store.
@@ -255,4 +255,4 @@ let
255255
;
256256

257257
in
258-
generators.toINI {} supervisorConf
258+
lib.generators.toINI {} supervisorConf

nix/workbench/backend/supervisor.nix

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
{ pkgs
2-
, lib
32
, haskellProject
43
, stateDir
54
, basePort
65
, useCabalRun
76
, profiling
87
, ...
98
}:
10-
with lib;
9+
with pkgs.lib;
1110
let
1211
extraShellPkgs = with pkgs;
1312
[
@@ -22,7 +21,7 @@ let
2221
"workbench-backend-data-${profileBundle.profile.value.name}-supervisor"
2322
{ # Create a `supervisord.conf`
2423
supervisorConf = import ./supervisor-conf.nix
25-
{ inherit pkgs lib stateDir;
24+
{ inherit pkgs stateDir;
2625
profile = profileBundle.profile.value;
2726
inherit profiling;
2827
nodeSpecs = profileBundle.node-specs.value;

nix/workbench/default.nix

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# The workbench entrypoint,
2-
{ pkgs, lib
2+
{ pkgs
33
# This provided project attrset will be used all over the workbench instead
44
# of the flake's `pkgs` or `cardanoNodePackages`. This allows to easily
55
# parametrize the whole build at any point, be it only for the workbench in
@@ -14,10 +14,10 @@
1414
, haskellProject
1515
}:
1616

17-
with lib;
18-
1917
let
2018

19+
inherit (pkgs) lib;
20+
2121
# Workbench derivation to create derivations from `wb` commands.
2222
##############################################################################
2323

@@ -43,7 +43,7 @@ let
4343
profile = [".sh" ".json"];
4444
topology = [".sh"];
4545
};
46-
in lib.any id [
46+
in lib.any lib.id [
4747
# Include the "wb" file (has no ".sh", workbench's entrypoint).
4848
(relativePath == "wb")
4949
# Include all top level "*.sh" files.
@@ -61,8 +61,8 @@ let
6161
)
6262
)
6363
# Include only the extensions defined above.
64-
(lib.any id
65-
(lib.attrValues (mapAttrs
64+
(lib.any lib.id
65+
(lib.attrValues (lib.mapAttrs
6666
(dirName: suffixes:
6767
(lib.hasPrefix (dirName + "/") relativePath)
6868
&&
@@ -108,7 +108,7 @@ let
108108
# Output
109109
################################################################################
110110

111-
in pkgs.lib.fix (self: {
111+
in lib.fix (self: {
112112

113113
inherit workbench;
114114
inherit haskellProject;
@@ -118,7 +118,7 @@ in pkgs.lib.fix (self: {
118118
# profileName -> profile
119119
profile = profileName:
120120
(import ./profile/profile.nix
121-
{ inherit pkgs lib;
121+
{ inherit pkgs;
122122
workbenchNix = self;
123123
inherit profileName;
124124
}
@@ -143,7 +143,7 @@ in pkgs.lib.fix (self: {
143143
, profiling
144144
}:
145145
(backendRegistry."${backendName}")
146-
{ inherit pkgs lib;
146+
{ inherit pkgs;
147147
inherit haskellProject;
148148
inherit stateDir basePort;
149149
# The `useCabalRun` and `profiling` flags are set in the backend to
@@ -187,7 +187,7 @@ in pkgs.lib.fix (self: {
187187
;
188188
in import ./backend/runner.nix
189189
{
190-
inherit pkgs lib;
190+
inherit pkgs;
191191
inherit haskellProject;
192192
inherit workbench;
193193
inherit profile backend;

nix/workbench/profile/profile.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs, lib
1+
{ pkgs
22
# The workbench attrset as it was parametrized.
33
, workbenchNix
44
, profileName

0 commit comments

Comments
 (0)