Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid eval time dependency on cardano-cli and cardano-topology #2730

Merged
merged 1 commit into from
May 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions nix/workbench/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let
then "cabal-exes+nix-wb"
else "nix-exes+nix-wb";

workbench =
workbench' = tools:
stdenv.mkDerivation {
pname = "workbench";

Expand All @@ -38,14 +38,7 @@ let

postFixup = ''
wrapProgram "$out/bin/wb" --argv0 wb --add-flags "--set-mode ${nixWbMode}" \
--prefix PATH ":" ${pkgs.lib.makeBinPath
[ git graphviz
jq
moreutils

cardano-cli
cardano-topology
]}
--prefix PATH ":" ${pkgs.lib.makeBinPath tools}
'';

installPhase = ''
Expand All @@ -56,12 +49,27 @@ let
dontStrip = true;
};

workbench = workbench'
[ git graphviz
jq
moreutils

cardano-cli
cardano-topology
];

runWorkbench =
name: command:
runCommand name {} ''
${workbench}/bin/wb ${command} > $out
'';

runWorkbenchJqOnly =
name: command:
runCommand name {} ''
${workbench' [jq]}/bin/wb ${command} > $out
'';

runJq =
name: args: query:
runCommand name {} ''
Expand Down Expand Up @@ -146,7 +154,7 @@ let
}:
rec {
profile-names-json =
runWorkbench "profile-names.json" "profiles list";
runWorkbenchJqOnly "profile-names.json" "profiles list";

profile-names =
__fromJSON (__readFile profile-names-json);
Expand All @@ -170,7 +178,7 @@ let
pkgs.callPackage ./profiles
{ inherit
pkgs
runWorkbench runJq workbench
runWorkbenchJqOnly runJq workbench
backend
environment
profileName;
Expand Down
8 changes: 4 additions & 4 deletions nix/workbench/profiles/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ pkgs
, runCommand, runWorkbench, runJq, workbench, writeText
, runCommand, runWorkbenchJqOnly, runJq, workbench, writeText

## The backend is an attrset of AWS/supervisord-specific methods and parameters.
, backend
Expand All @@ -14,7 +14,7 @@
}:

let
baseJSON = runWorkbench "profile-${profileName}.json"
baseJSON = runWorkbenchJqOnly "profile-${profileName}.json"
"profile get ${profileName}";
JSON =
if profileOverride == {}
Expand Down Expand Up @@ -43,7 +43,7 @@ let

node-specs =
rec {
JSON = runWorkbench
JSON = runWorkbenchJqOnly
"node-specs-${profile.name}.json"
"profile node-specs ${profile.JSON} ${environment.JSON}";

Expand All @@ -52,7 +52,7 @@ let

inherit (pkgs.callPackage
./node-services.nix
{ inherit runJq runWorkbench backend environment profile; })
{ inherit runJq backend environment profile; })
node-services;
};

Expand Down
2 changes: 1 addition & 1 deletion nix/workbench/profiles/node-services.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ pkgs
, runJq, runWorkbench
, runJq

## The backend is an attrset of AWS/supervisord-specific methods and parameters.
, backend
Expand Down