-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workbench: refactoring of modules dependencies
- Remove repeated code (services-config) from backends - Move 'services-config' to profiles and out of the backends - Move the backend dependency out from 'all-profiles' - Remove unused code and parameters or its defaults - Remove 'stateDir' from the backends - Renames for clarity
- Loading branch information
Showing
13 changed files
with
206 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,60 @@ | ||
let | ||
basePort = 30000; | ||
cacheDirDefault = "${__getEnv "HOME"}/.cache/cardano-workbench"; | ||
stateDir = "run/current"; | ||
in | ||
{ pkgs | ||
, lib | ||
, workbench | ||
## | ||
, cacheDir ? cacheDirDefault | ||
, extraBackendConfig ? {} | ||
## `useCabalRun` not used here like in `supervisor.nix`. | ||
, ... | ||
}: | ||
let | ||
backend = | ||
rec | ||
{ name = "nomad"; | ||
|
||
# Unlike the supervisor backend `useCabalRun` is always false here. | ||
useCabalRun = false; | ||
name = "nomad"; | ||
|
||
services-config = import ./services-config.nix {inherit lib workbench basePort stateDir; useCabalRun = false;}; | ||
# Unlike the supervisor backend `useCabalRun` is always false here. | ||
useCabalRun = false; | ||
|
||
extraShellPkgs = with pkgs; [ | ||
# https://docs.podman.io/en/latest/markdown/podman.1.html#rootless-mode | ||
podman | ||
# Was not needed even thou it says so! | ||
# https://docs.podman.io/en/latest/markdown/podman.1.html#note-unsupported-file-systems-in-rootless-mode | ||
# fuse-overlayfs | ||
nomad | ||
nomad-driver-podman | ||
]; | ||
extraShellPkgs = with pkgs; [ | ||
# https://docs.podman.io/en/latest/markdown/podman.1.html#rootless-mode | ||
podman | ||
# Was not needed even thou it says so! | ||
# https://docs.podman.io/en/latest/markdown/podman.1.html#note-unsupported-file-systems-in-rootless-mode | ||
# fuse-overlayfs | ||
nomad | ||
nomad-driver-podman | ||
]; | ||
|
||
materialise-profile = | ||
{ profileNix }: | ||
let | ||
supervisorConfPath = | ||
import ./supervisor-conf.nix | ||
{ inherit (profileNix) node-services; | ||
inherit | ||
pkgs lib stateDir | ||
basePort | ||
extraBackendConfig; | ||
unixHttpServerPort = "/tmp/supervisor.sock"; | ||
}; | ||
nomadConf = | ||
import ./nomad-conf.nix | ||
{ inherit pkgs; | ||
inherit | ||
(pkgs.cardanoNodePackages) | ||
cardano-node cardano-tracer tx-generator; | ||
}; | ||
in pkgs.runCommand "workbench-backend-output-${profileNix.name}-${name}" | ||
(rec { | ||
inherit supervisorConfPath; | ||
# All In One | ||
clusterImage = nomadConf.clusterImage; | ||
clusterImageCopyToPodman = clusterImage.copyToPodman; | ||
clusterImageName = clusterImage.imageName; | ||
clusterImageTag = clusterImage.imageTag; | ||
}) | ||
'' | ||
mkdir $out | ||
materialise-profile = | ||
{ stateDir, profileNix }: | ||
let | ||
supervisorConfPath = | ||
import ./supervisor-conf.nix | ||
{ inherit (profileNix) node-services; | ||
inherit pkgs lib stateDir; | ||
unixHttpServerPort = "/tmp/supervisor.sock"; | ||
}; | ||
nomadConf = | ||
import ./nomad-conf.nix | ||
{ inherit pkgs; | ||
inherit | ||
(pkgs.cardanoNodePackages) | ||
cardano-node cardano-tracer tx-generator; | ||
}; | ||
in pkgs.runCommand "workbench-backend-output-${profileNix.name}-${name}" | ||
(rec { | ||
inherit supervisorConfPath; | ||
# All In One | ||
clusterImage = nomadConf.clusterImage; | ||
clusterImageCopyToPodman = clusterImage.copyToPodman; | ||
clusterImageName = clusterImage.imageName; | ||
clusterImageTag = clusterImage.imageTag; | ||
}) | ||
'' | ||
mkdir $out | ||
ln -s $supervisorConfPath $out/supervisor.conf | ||
ln -s $supervisorConfPath $out/supervisor.conf | ||
ln -s $clusterImage $out/clusterImage | ||
echo $clusterImageName > $out/clusterImageName | ||
echo $clusterImageTag > $out/clusterImageTag | ||
ln -s $clusterImageCopyToPodman/bin/copy-to-podman $out/clusterImageCopyToPodman | ||
''; | ||
}; | ||
ln -s $clusterImage $out/clusterImage | ||
echo $clusterImageName > $out/clusterImageName | ||
echo $clusterImageTag > $out/clusterImageTag | ||
ln -s $clusterImageCopyToPodman/bin/copy-to-podman $out/clusterImageCopyToPodman | ||
''; | ||
in | ||
{ | ||
inherit cacheDir stateDir basePort; | ||
inherit workbench; | ||
inherit backend; | ||
inherit name useCabalRun extraShellPkgs materialise-profile; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.