Skip to content

Commit

Permalink
Move docker-compose creation code
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaste committed Aug 8, 2022
1 parent 83a4f7d commit 221b3b0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 108 deletions.
6 changes: 3 additions & 3 deletions nix/pkgs.nix
Expand Up @@ -85,9 +85,9 @@ final: prev: with final; {
{ workbench ? pkgs.workbench, ... }@args: pkgs.callPackage ./workbench/backend/supervisor.nix args;

docker-workbench-cabal =
{ workbench ? pkgs.workbench, ... }@args: pkgs.callPackage ./workbench/backend/docker.nix (args // { useCabalRun = true; });
{ workbench ? pkgs.workbench, ... }@args: pkgs.callPackage ./workbench/backend/docker.nix (args // { inherit cardano-world; useCabalRun = true; });
docker-workbench-nix =
{ workbench ? pkgs.workbench, ... }@args: pkgs.callPackage ./workbench/backend/docker.nix args;
{ workbench ? pkgs.workbench, ... }@args: pkgs.callPackage ./workbench/backend/docker.nix (args // { inherit cardano-world; });

all-profiles-json = (workbench.all-profiles{ inherit (supervisord-workbench-nix) backend; }).JSON;

Expand All @@ -114,7 +114,7 @@ final: prev: with final; {
, useCabalRun ? false
, workbenchDevMode ? false
, profiled ? false
, docker-workbench ? pkgs.callPackage ./workbench/backend/docker.nix { inherit useCabalRun; }
, docker-workbench ? pkgs.callPackage ./workbench/backend/docker.nix { inherit cardano-world useCabalRun; }
, cardano-node-rev ? null
}:
pkgs.callPackage ./workbench/backend/docker-run.nix
Expand Down
79 changes: 0 additions & 79 deletions nix/workbench/backend/docker-conf.nix

This file was deleted.

27 changes: 11 additions & 16 deletions nix/workbench/backend/docker.nix
Expand Up @@ -5,16 +5,15 @@ let
in
{ pkgs
, lib
, cardano-world
, workbench
##
, cacheDir ? cacheDirDefault
, extraBackendConfig ? {}
, useCabalRun ? false
, enableEKG ? true
##
, ...
}:
with lib;
let
backend =
rec
Expand All @@ -24,23 +23,19 @@ let

materialise-profile =
{ profileNix }:
pkgs.runCommand "workbench-profile-outputs-${profileNix.name}-${name}d" {}
pkgs.runCommand "workbench-profile-outputs-${profileNix.name}-${name}d"
{ buildInputs = [ workbench.workbench ];
cardanoNodeImageName = cardano-world.x86_64-linux.cardano.oci-images.cardano-node.imageName;
cardanoNodeImageTag = cardano-world.x86_64-linux.cardano.oci-images.cardano-node.imageTag;
}
''
mkdir $out
cp ${mkBackendConf profileNix} $out/docker.conf
'';
## Backend-specific Nix bits:
## mkBackendConf :: Profile -> SupervisorConf/DockerConf
mkBackendConf =
profile:
pkgs.callPackage ./docker-conf.nix
{ inherit (profile) node-services;
inherit
pkgs lib stateDir
basePort
extraBackendConfig;
};
echo $cardanoNodeImageName > $out/cardanoNodeImageName
echo $cardanoNodeImageTag > $out/cardanoNodeImageTag
wb app compose ${profileNix.JSON} ${profileNix.node-specs.JSON} $cardanoNodeImageName $cardanoNodeImageTag > $out/docker-compose.yaml
'';
};
in
{
Expand Down
3 changes: 1 addition & 2 deletions nix/workbench/default.nix
Expand Up @@ -2,7 +2,6 @@
, lib, jq, runCommand
, db-analyser
, cardanoNodePackages
, cardano-world
}:

with lib;
Expand Down Expand Up @@ -91,7 +90,7 @@ let
};

## materialise-profile :: ProfileNix -> BackendProfile -> Profile
materialise-profile = import ./profile.nix { inherit pkgs lib cardano-world; };
materialise-profile = import ./profile.nix { inherit pkgs lib; };
## profile-topology :: ProfileNix -> Topology
profile-topology = import ./topology.nix { inherit pkgs; };
## profile-topology :: ProfileNix -> Topology -> Genesis
Expand Down
10 changes: 2 additions & 8 deletions nix/workbench/profile.nix
@@ -1,12 +1,12 @@
{ pkgs, lib, cardano-world }:
{ pkgs, lib }:
with lib;

{ profileNix
, backendProfile ## Backend-specific results for forwarding
, workbench
}:
pkgs.runCommand "workbench-profile-output-${profileNix.name}"
{ buildInputs = with pkgs; [ jq yq workbench ];
{ buildInputs = with pkgs; [ jq workbench ];
nodeServices =
__toJSON
(flip mapAttrs profileNix.node-services
Expand Down Expand Up @@ -35,8 +35,6 @@ pkgs.runCommand "workbench-profile-output-${profileNix.name}"
config = config.JSON;
start = startupScript;
};
cardanoNodeImageName = cardano-world.x86_64-linux.cardano.oci-images.cardano-node.imageName;
cardanoNodeImageTag = cardano-world.x86_64-linux.cardano.oci-images.cardano-node.imageTag;
passAsFile = [ "nodeServices" "generatorService" "tracerService" ];
}
''
Expand All @@ -48,10 +46,6 @@ pkgs.runCommand "workbench-profile-output-${profileNix.name}"
cp $tracerServicePath $out/tracer-service.json
wb profile node-specs $out/profile.json > $out/node-specs.json
echo $cardanoNodeImageName > $out/cardanoNodeImageName
echo $cardanoNodeImageTag > $out/cardanoNodeImageTag
wb app compose $out/profile.json $out/node-specs.json $cardanoNodeImageName $cardanoNodeImageTag > $out/docker-compose.yaml
''
// { inherit (profileNix) name;
inherit workbench;
Expand Down

0 comments on commit 221b3b0

Please sign in to comment.