commit 7faf620c0bc5505d93f577ee931332c37b0c31db
parent b094220466e26aa0317f593eca5717f694f90287
Author: Daniel Barlow <dan@telent.net>
Date: Thu, 31 Aug 2023 18:28:35 +0100
move loopback config from base to netowrk module
Diffstat:
2 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/modules/base.nix b/modules/base.nix
@@ -80,18 +80,6 @@ in {
defaultProfile.packages = with pkgs;
[ s6 s6-init-bin execline s6-linux-init s6-rc ];
- hardware.networkInterfaces = {
- lo =
- let iface = interface { type = "loopback"; device = "lo";};
- in bundle {
- name = "loopback";
- contents = [
- (address iface { family = "inet4"; address ="127.0.0.1"; prefixLength = 8;})
- (address iface { family = "inet6"; address ="::1"; prefixLength = 128;})
- ];
- };
- };
-
boot.commandLine = [
"console=ttyS0,115200 panic=10 oops=panic init=/bin/init loglevel=8"
"root=${config.hardware.rootDevice}"
diff --git a/modules/network/default.nix b/modules/network/default.nix
@@ -9,6 +9,7 @@
let
inherit (lib) mkOption types;
inherit (pkgs) liminix;
+ inherit (pkgs.liminix.services) bundle;
in {
options = {
system.service.network = {
@@ -31,6 +32,30 @@ in {
};
};
config = {
+ hardware.networkInterfaces = {
+ lo =
+ let
+ net = config.system.service.network;
+ iface = net.link.build { ifname = "lo";};
+ in bundle {
+ name = "loopback";
+ contents = [
+ ( net.address.build {
+ interface = iface;
+ family = "inet";
+ address ="127.0.0.1";
+ prefixLength = 8;
+ })
+ ( net.address.build {
+ interface = iface;
+ family = "inet6";
+ address = "::1";
+ prefixLength = 128;
+ })
+ ];
+ };
+ };
+
system.service.network = {
link = liminix.callService ./link.nix {
ifname = mkOption {