From b01b5088fd446755df6f487ab0d80335140a70ee Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Sun, 26 Jul 2020 00:34:08 +0200 Subject: [PATCH 1/2] start working on Hash2Pub testbed as a nixos container --- nixos/Hash2PubTestbed.nix | 46 +++++++++++++++++++++++++++++++++++++++ nixos/configuration.nix | 8 +++++++ 2 files changed, 54 insertions(+) create mode 100644 nixos/Hash2PubTestbed.nix diff --git a/nixos/Hash2PubTestbed.nix b/nixos/Hash2PubTestbed.nix new file mode 100644 index 0000000..dec7d72 --- /dev/null +++ b/nixos/Hash2PubTestbed.nix @@ -0,0 +1,46 @@ +{ 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" + '') + ]; + }; +} diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 62c04de..3a4461b 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -196,6 +196,14 @@ in # package debugging # programs.sysdig.enable = true; + # declarative containers + containers = { + hash2PubSim = import ./Hash2PubTestbed.nix {inherit pkgs config;}; + }; + + # stop NetworkManager from managing virtual interfaces + networking.networkmanager.unmanaged = [ "interface-name:ve-*" ]; + # This value determines the NixOS release with which your system is to be # compatible, in order to avoid breaking some software such as database # servers. You should change this only after NixOS release notes say you From 3cb108c8671c792cc7319a04df832d79bb52fad1 Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Sun, 26 Jul 2020 00:34:42 +0200 Subject: [PATCH 2/2] remove hie from global environment, is going to be put into project environments in the future --- all-hies | 1 - home/home.nix | 4 ---- 2 files changed, 5 deletions(-) delete mode 160000 all-hies diff --git a/all-hies b/all-hies deleted file mode 160000 index 706058c..0000000 --- a/all-hies +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 706058c72696a238efe498c9f4af947e5480b9e3 diff --git a/home/home.nix b/home/home.nix index 7f4bbc4..12a8ef4 100644 --- a/home/home.nix +++ b/home/home.nix @@ -5,8 +5,6 @@ with pkgs; let unstable = import {}; mybrowser = firefox; - #all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {}; - all-hies = import ../all-hies {}; desktopApps = [ mybrowser @@ -179,8 +177,6 @@ let # Haskell ghc cabal2nix - #only temporary until auto-selecting the current channel version works - (all-hies.selection { selector = p: { inherit (p) ghc865; }; }) ];