nixconfigs/nixos/Hash2PubTestbed.nix

47 lines
1.3 KiB
Nix

{ config, pkgs, ... }:
let
projectDir = "/home/spiollinux/Seafile/Studium/Semester11/INF-PM-FP-ANW";
projectPath = builtins.toPath projectDir;
projectMount = "/mnt/project";
shell = import (projectDir + "/Hash2Pub/shell.nix");
in
{
privateNetwork = true;
ephemeral = true;
bindMounts = {
"${projectMount}" = { hostPath = projectDir; isReadOnly = false; };
};
config = {
networking = {
firewall.enable = false;
interfaces.lo.ipv6.addresses = [
{address = "2604:a880:800:10::34e1:d001"; prefixLength = 0;}
{address = "2001:41d0:2:c0af::15"; prefixLength = 0;}
{address = "2a01:e0a:23a:5600::2"; prefixLength = 64;}
];
extraHosts = ''
2604:a880:800:10::34e1:d001 animalliberation.social
2001:41d0:2:c0af::15 hostux.social
2a01:e0a:23a:5600::2 social.imirhil.fr
'';
};
environment.systemPackages = [
pkgs.netcat
pkgs.iproute
pkgs.tmux
pkgs.ping
(pkgs.writeShellScriptBin "doSimulation" ''
# 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 simtest.sh"
'')
];
};
}