update Hash2Pub testbed container and make it more configurable
This commit is contained in:
parent
231d81043e
commit
f1da50c5c0
|
@ -1,10 +1,20 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, experimentUid ? 1000, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
projectDir = "/home/spiollinux/Seafile/Studium/Semester11/INF-PM-FP-ANW";
|
projectDir = "/home/spiollinux/Seafile/Studium/Semester11/INF-PM-FP-ANW";
|
||||||
projectPath = builtins.toPath projectDir;
|
projectPath = builtins.toPath projectDir;
|
||||||
projectMount = "/mnt/project";
|
projectMount = "/mnt/project";
|
||||||
shell = import (projectDir + "/Hash2Pub/shell.nix");
|
shell = (import (projectDir + "/Hash2Pub/default.nix") {}).shell;
|
||||||
|
simulationSetupScript = pkgs.writeShellScriptBin "simulationSetup" ''
|
||||||
|
# make cabal-install work offline
|
||||||
|
mkdir $HOME/.cabal
|
||||||
|
echo "" > $HOME/.cabal/config
|
||||||
|
|
||||||
|
# run simulation script within the shell
|
||||||
|
${pkgs.nix}/bin/nix-shell ${shell.drvPath} --command "cd ${projectMount} && bash ./build/simulationrunner.sh 2>&1"
|
||||||
|
'';
|
||||||
|
instanceData = builtins.fromJSON (builtins.readFile "${projectDir}/simulationData/inputs/generated/instances_sample.json");
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -17,30 +27,36 @@ in
|
||||||
config = {
|
config = {
|
||||||
networking = {
|
networking = {
|
||||||
firewall.enable = false;
|
firewall.enable = false;
|
||||||
interfaces.lo.ipv6.addresses = [
|
interfaces.lo.ipv6.addresses =
|
||||||
{address = "2604:a880:800:10::34e1:d001"; prefixLength = 0;}
|
builtins.map (inst: {address = inst.ip; prefixLength = 0;}) instanceData;
|
||||||
{address = "2001:41d0:2:c0af::15"; prefixLength = 0;}
|
extraHosts =
|
||||||
{address = "2a01:e0a:23a:5600::2"; prefixLength = 64;}
|
pkgs.lib.concatMapStringsSep "\n" (inst: "${inst.ip} ${inst.hostname}") instanceData;
|
||||||
];
|
|
||||||
extraHosts = ''
|
|
||||||
2604:a880:800:10::34e1:d001 animalliberation.social
|
|
||||||
2001:41d0:2:c0af::15 hostux.social
|
|
||||||
2a01:e0a:23a:5600::2 social.imirhil.fr
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
# avoid permission problems with project builds
|
||||||
|
users.users.experimentor = {
|
||||||
|
uid = experimentUid;
|
||||||
|
isNormalUser = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# adjust open file limits
|
||||||
|
security.pam.loginLimits = [{
|
||||||
|
domain = "*"
|
||||||
|
; type = "-"
|
||||||
|
; item = "nofile"
|
||||||
|
; value = "50000"
|
||||||
|
;}];
|
||||||
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
pkgs.netcat
|
pkgs.netcat
|
||||||
pkgs.iproute
|
pkgs.iproute
|
||||||
pkgs.tmux
|
pkgs.tmux
|
||||||
pkgs.ping
|
pkgs.ping
|
||||||
|
pkgs.lsof
|
||||||
|
pkgs.iftop
|
||||||
(pkgs.writeShellScriptBin "doSimulation" ''
|
(pkgs.writeShellScriptBin "doSimulation" ''
|
||||||
# make cabal-install work offline
|
su experimentor -c "${simulationSetupScript}/bin/simulationSetup"
|
||||||
mkdir $HOME/.cabal
|
|
||||||
echo "" > $HOME/.cabal/config
|
|
||||||
|
|
||||||
# run simulation script within the shell
|
|
||||||
${pkgs.nix}/bin/nix-shell ${shell.drvPath} --command "cd ${projectMount} && bash simtest.sh"
|
|
||||||
'')
|
'')
|
||||||
|
pkgs.tcpdump
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,12 @@ in
|
||||||
|
|
||||||
# declarative containers
|
# declarative containers
|
||||||
containers = {
|
containers = {
|
||||||
hash2PubSim = import ./Hash2PubTestbed.nix {inherit pkgs config;};
|
hash2PubSim = import ./Hash2PubTestbed.nix
|
||||||
|
{
|
||||||
|
inherit pkgs config;
|
||||||
|
experimentUid = config.users.users.spiollinux.uid;
|
||||||
|
projectDir = "/home/spiollinux/Seafile/Studium/Semester11/INF-PM-FP-ANW";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# stop NetworkManager from managing virtual interfaces
|
# stop NetworkManager from managing virtual interfaces
|
||||||
|
|
Loading…
Reference in a new issue