2022-09-25 12:22:15 +02:00
|
|
|
{ config, pkgs, ... } :
|
2022-09-20 00:51:38 +02:00
|
|
|
let
|
2022-09-26 13:55:10 +02:00
|
|
|
inherit (pkgs.liminix.networking) interface address udhcpc odhcpc route;
|
2022-10-02 17:35:55 +02:00
|
|
|
inherit (pkgs.liminix.services) oneshot longrun bundle target;
|
2023-06-20 23:04:12 +02:00
|
|
|
inherit (pkgs) writeText;
|
2022-09-20 00:51:38 +02:00
|
|
|
in rec {
|
2023-02-11 14:10:38 +01:00
|
|
|
imports = [
|
2023-05-17 22:51:54 +02:00
|
|
|
./modules/tftpboot.nix
|
2023-02-22 19:41:41 +01:00
|
|
|
./modules/wlan.nix
|
2023-02-11 14:10:38 +01:00
|
|
|
];
|
2023-03-07 23:02:24 +01:00
|
|
|
services.loopback = config.hardware.networkInterfaces.lo;
|
|
|
|
|
2022-09-20 00:51:38 +02:00
|
|
|
services.dhcpv4 =
|
2023-05-07 23:52:09 +02:00
|
|
|
let iface = interface { type = "hardware"; device = "eth1"; };
|
2022-09-20 00:51:38 +02:00
|
|
|
in udhcpc iface {};
|
|
|
|
|
|
|
|
services.dhcpv6 =
|
2023-05-07 23:52:09 +02:00
|
|
|
let iface = interface { type = "hardware"; device = "eth1"; };
|
2022-09-20 00:51:38 +02:00
|
|
|
in odhcpc iface { uid = "e7"; };
|
|
|
|
|
2022-09-26 13:55:10 +02:00
|
|
|
services.defaultroute4 = route {
|
|
|
|
name = "defautlrote";
|
2022-10-02 17:35:55 +02:00
|
|
|
via = "$(output ${services.dhcpv4} address)";
|
2022-09-26 13:55:10 +02:00
|
|
|
target = "default";
|
|
|
|
dependencies = [ services.dhcpv4 ];
|
|
|
|
};
|
|
|
|
|
|
|
|
services.packet_forwarding =
|
|
|
|
let
|
|
|
|
iface = services.dhcpv4;
|
2022-10-02 17:35:55 +02:00
|
|
|
filename = "/proc/sys/net/ipv4/conf/$(output ${iface} ifname)/forwarding";
|
2022-09-20 00:51:38 +02:00
|
|
|
in oneshot {
|
2022-09-26 13:55:10 +02:00
|
|
|
name = "let-the-ip-flow";
|
|
|
|
up = "echo 1 > ${filename}";
|
|
|
|
down = "echo 0 > ${filename}";
|
|
|
|
dependencies = [iface];
|
2022-09-20 00:51:38 +02:00
|
|
|
};
|
2022-09-22 01:10:55 +02:00
|
|
|
|
2023-06-20 23:04:12 +02:00
|
|
|
services.ntp =
|
|
|
|
let config = writeText "chrony.conf" ''
|
|
|
|
pool pool.ntp.org iburst
|
|
|
|
dumpdir /run/chrony
|
|
|
|
makestep 1.0 3
|
|
|
|
'';
|
|
|
|
in longrun {
|
|
|
|
name = "ntp";
|
|
|
|
run = "${pkgs.chrony}/bin/chronyd -f ${config} -d";
|
|
|
|
};
|
|
|
|
|
2022-09-22 01:10:55 +02:00
|
|
|
services.default = target {
|
|
|
|
name = "default";
|
|
|
|
contents = with services; [ loopback ntp defaultroute4 ];
|
|
|
|
};
|
|
|
|
|
2023-02-11 14:28:25 +01:00
|
|
|
boot.tftp = {
|
|
|
|
serverip = "192.168.8.148";
|
|
|
|
ipaddr = "192.168.8.251";
|
|
|
|
};
|
|
|
|
|
2022-09-27 17:17:55 +02:00
|
|
|
defaultProfile.packages = [ pkgs.hello ] ;
|
2022-09-20 00:51:38 +02:00
|
|
|
}
|