mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-12-02 21:16:15 +01:00
93 lines
1.9 KiB
Nix
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"
|
||
|
];
|
||
|
}
|