[treewide] reformat all files with nixfmt-rfc-style

This commit is contained in:
Trolli Schmittlauch 2024-03-16 17:18:20 +01:00
parent 3a31c21ae2
commit 2bdff39416
17 changed files with 653 additions and 531 deletions

View file

@ -1,10 +1,15 @@
{ config, pkgs, experimentUid ? 1000, ... }:
{
config,
pkgs,
experimentUid ? 1000,
...
}:
let
projectDir = "/home/spiollinux/Seafile/Studium/Semester11/INF-PM-FP-ANW";
projectPath = builtins.toPath projectDir;
projectMount = "/mnt/project";
shell = (import (projectDir + "/Hash2Pub/default.nix") {}).shell;
shell = (import (projectDir + "/Hash2Pub/default.nix") { }).shell;
simulationSetupScript = pkgs.writeShellScriptBin "simulationSetup" ''
# make cabal-install work offline
mkdir $HOME/.cabal
@ -12,25 +17,30 @@ let
# 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");
'';
instanceData = builtins.fromJSON (
builtins.readFile "${projectDir}/simulationData/inputs/generated/instances_sample.json"
);
in
{
privateNetwork = true;
ephemeral = true;
bindMounts = {
"${projectMount}" = { hostPath = projectDir; isReadOnly = false; };
"${projectMount}" = {
hostPath = projectDir;
isReadOnly = false;
};
};
config = {
networking = {
firewall.enable = false;
interfaces.lo.ipv6.addresses =
builtins.map (inst: {address = inst.ip; prefixLength = 0;}) instanceData;
extraHosts =
pkgs.lib.concatMapStringsSep "\n" (inst: "${inst.ip} ${inst.hostname}") instanceData;
interfaces.lo.ipv6.addresses = builtins.map (inst: {
address = inst.ip;
prefixLength = 0;
}) instanceData;
extraHosts = pkgs.lib.concatMapStringsSep "\n" (inst: "${inst.ip} ${inst.hostname}") instanceData;
};
# avoid permission problems with project builds
users.users.experimentor = {
@ -39,12 +49,14 @@ in
};
# adjust open file limits
security.pam.loginLimits = [{
domain = "*"
; type = "-"
; item = "nofile"
; value = "50000"
;}];
security.pam.loginLimits = [
{
domain = "*";
type = "-";
item = "nofile";
value = "50000";
}
];
environment.systemPackages = [
pkgs.netcat
@ -55,7 +67,7 @@ in
pkgs.iftop
(pkgs.writeShellScriptBin "doSimulation" ''
su experimentor -c "${simulationSetupScript}/bin/simulationSetup"
'')
'')
pkgs.tcpdump
];
};