From 23ccfec5fb6cba4ef746ef604a23361b458688f8 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Mon, 28 Aug 2023 16:08:46 +0100 Subject: [PATCH] update examples so they build again --- examples/arhcive.nix | 12 ++++++------ examples/extneder.nix | 40 ++++++++++++++++------------------------ 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/examples/arhcive.nix b/examples/arhcive.nix index ea348d3..bd4bfd5 100644 --- a/examples/arhcive.nix +++ b/examples/arhcive.nix @@ -13,14 +13,12 @@ secrets = import ./extneder-secrets.nix; inherit (pkgs.liminix.networking) - address - udhcpc - interface route ; inherit (pkgs.liminix.services) oneshot longrun bundle target; inherit (pkgs.pseudofile) dir symlink; inherit (pkgs) writeText dropbear ifwait serviceFns; + svc = config.system.service; in rec { boot = { tftp = { @@ -32,6 +30,7 @@ in rec { imports = [ ../modules/standard.nix ../modules/wlan.nix + ../modules/network ]; hostname = "arhcive"; @@ -62,10 +61,11 @@ in rec { }; services.dhcpc = - let iface = config.hardware.networkInterfaces.lan; - in (udhcpc iface { + let iface = config.hardware.networkInterfaces.lan; + in svc.network.dhcp.client.build { + interface = iface; dependencies = [ config.services.hostname ]; - }) // { inherit (iface) device; }; + }; services.sshd = longrun { name = "sshd"; diff --git a/examples/extneder.nix b/examples/extneder.nix index a2eaf9a..7ed8fd5 100644 --- a/examples/extneder.nix +++ b/examples/extneder.nix @@ -14,15 +14,13 @@ inherit (pkgs.liminix.networking) address - udhcpc - hostapd interface route ; inherit (pkgs.liminix.services) oneshot longrun bundle target; inherit (pkgs.pseudofile) dir symlink; - inherit (pkgs) dropbear ifwait serviceFns - ; + inherit (pkgs) dropbear ifwait serviceFns; + svc = config.system.service; in rec { boot = { tftp = { @@ -33,6 +31,9 @@ in rec { imports = [ ../modules/wlan.nix + ../modules/network + ../modules/hostapd + ../modules/bridge ../modules/standard.nix ]; @@ -71,7 +72,8 @@ in rec { }; }; - services.hostap = hostapd (config.hardware.networkInterfaces.wlan) { + services.hostap = svc.hostapd.build { + interface = config.hardware.networkInterfaces.wlan; params = { country_code = "GB"; hw_mode = "g"; @@ -91,28 +93,18 @@ in rec { device = "int"; }; - services.dhcpc = (udhcpc services.int { + services.dhcpc = svc.network.dhcp.client.build { + interface = services.int; dependencies = [ config.services.hostname ]; - }) // { device = "int"; }; + }; - services.bridge = let + services.bridge = svc.bridge.members.build { primary = services.int; - addif = dev: - oneshot { - name = "add-${dev.device}-to-bridge"; - up = "${ifwait}/bin/ifwait -v ${dev.device} running && ip link set dev ${dev.device} master ${primary.device}"; - down = "ip link set dev ${dev} nomaster"; - dependencies = [primary dev]; - }; - in - bundle { - name = "bridge-members"; - contents = with config.hardware.networkInterfaces; - map addif [ - lan - wlan - ]; - }; + members = with config.hardware.networkInterfaces; [ + lan + wlan + ]; + }; services.sshd = longrun { name = "sshd";