dotfiles/nixos/tests/hel/jormungandr.nix
magic_rb 0e7389fcbd
More network test work
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-08-14 15:59:24 +02:00

93 lines
1.9 KiB
Nix

{
inputs',
pkgs,
lib,
...
}: let
inherit
(lib)
concatMap
getExe'
;
in {
imports = [
inputs'.self.nixosModules.ifstate
inputs'.self.nixosModules.netnsIf
./pppoe-server.nix
./qemu-vm.nix
];
nixpkgs.overlays = [
inputs'.self.overlays.ifstate
(final: _: {
rp-pppoe = final.callPackage ./rp-pppoe.nix {
ppp = final.ppp.overrideAttrs (_: {
patches = [
./0003-Wait-for-ip-up-down-scripts.patch
./0002-Call-scripts-with-the-same-environ-as-pppd.patch
];
});
};
})
];
environment.systemPackages = [
pkgs.tcpdump
];
services.ifstate = {
enable = true;
settings = {
interfaces = [
{
name = "wan";
link = {
kind = "physical";
permaddr = "00:11:22:33:42:00";
state = "up";
};
}
{
name = "internet";
link = {
kind = "vlan";
link = "wan";
vlan_id = 6;
state = "up";
};
}
{
name = "www-br";
link = {
kind = "bridge";
state = "up";
};
}
];
};
};
services.pppoe-server.kpn = {
interface = "internet";
localAddress = "10.0.0.1";
remoteAddressFile = pkgs.writeText "kpn-remote-address-file" ''
10.67.15.1
'';
# ifUpScript = pkgs.writeShellScript "ppd-if-up" ''
# ${getExe' pkgs.iproute2 "ip"} link set dev "$PPP_IFACE" master ppp-br
# '';
};
networking = {
hostName = "jormungandr";
useDHCP = false;
firewall.enable = false;
};
virtualisation.qemu.options = [
"-net nic,model=e1000,macaddr=00:11:22:33:42:00,netdev=wan"
"-netdev stream,id=wan,addr.type=unix,addr.path=../../../midgard/link"
# "-netdev vde,id=wan,sock=../../../midgard/switch"
];
}