From e0ea576674599ba72df18d18d7eca64cbb625c1c Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Fri, 3 Mar 2023 22:52:33 +0000 Subject: [PATCH] rename "device" config tree as "hardware" we are also using "device" for "network device" (as in eth0, wlan0 etc) so this makes it a bit less confusing perhaps --- default.nix | 2 +- devices/gl-ar750/default.nix | 14 +++++++------- devices/gl-mt300a/default.nix | 14 +++++++------- devices/gl-mt300n-v2/default.nix | 15 ++++++++------- devices/qemu/default.nix | 2 +- modules/flashable.nix | 4 ++-- modules/hardware.nix | 2 +- modules/outputs.nix | 6 +++--- rotuer.nix | 14 +++++++------- tests/wlan/configuration.nix | 2 +- 10 files changed, 38 insertions(+), 37 deletions(-) diff --git a/default.nix b/default.nix index 9c90e74..987a951 100644 --- a/default.nix +++ b/default.nix @@ -40,7 +40,7 @@ let }).config.system; in { outputs = config.outputs // { - default = config.outputs.${config.device.defaultOutput}; + default = config.outputs.${config.hardware.defaultOutput}; }; # this is just here as a convenience, so that we can get a diff --git a/devices/gl-ar750/default.nix b/devices/gl-ar750/default.nix index 1221292..a513a78 100644 --- a/devices/gl-ar750/default.nix +++ b/devices/gl-ar750/default.nix @@ -87,7 +87,7 @@ inherit (pkgs.pseudofile) dir symlink; inherit (pkgs.liminix.networking) interface; in { - device = { + hardware = { defaultOutput = "tftproot"; loadAddress = "0x80060000"; entryPoint = "0x80060000"; @@ -96,6 +96,12 @@ size ="0xfa0000"; }; rootDevice = "1f05"; + dts = { + src = "${openwrt}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts"; + includes = [ + "${openwrt}/target/linux/ath79/dts" + ]; + }; networkInterfaces = { lan = interface { device = "eth0"; }; @@ -125,12 +131,6 @@ boot.tftp = { loadAddress = "0x00A00000"; }; - device.dts = { - src = "${openwrt}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts"; - includes = [ - "${openwrt}/target/linux/ath79/dts" - ]; - }; kernel = { src = pkgs.pkgsBuildBuild.fetchurl { name = "linux.tar.gz"; diff --git a/devices/gl-mt300a/default.nix b/devices/gl-mt300a/default.nix index c7ab986..040f99c 100644 --- a/devices/gl-mt300a/default.nix +++ b/devices/gl-mt300a/default.nix @@ -21,21 +21,21 @@ hash = "sha256-YYi4gkpLjbOK7bM2MGQjAyEBuXJ9JNXoz/JEmYf8xE8="; }; in { - device = { + hardware = { defaultOutput = "tftproot"; loadAddress = "0x80000000"; entryPoint = "0x80000000"; radios = ["rt2800soc"]; + dts = { + src = "${openwrt}/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts"; + includes = [ + "${openwrt}/target/linux/ramips/dts" + ]; + }; }; boot.tftp = { loadAddress = "0x00A00000"; }; - device.dts = { - src = "${openwrt}/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts"; - includes = [ - "${openwrt}/target/linux/ramips/dts" - ]; - }; kernel = { src = pkgs.fetchurl { diff --git a/devices/gl-mt300n-v2/default.nix b/devices/gl-mt300n-v2/default.nix index 9218e0d..c232689 100644 --- a/devices/gl-mt300n-v2/default.nix +++ b/devices/gl-mt300n-v2/default.nix @@ -21,21 +21,22 @@ hash = "sha256-YYi4gkpLjbOK7bM2MGQjAyEBuXJ9JNXoz/JEmYf8xE8="; }; in { - device = { + hardware = { defaultOutput = "tftproot"; loadAddress = "0x80000000"; entryPoint = "0x80000000"; radios = ["mt7603e"]; + dts = { + src = "${openwrt}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts"; + includes = [ + "${openwrt}/target/linux/ramips/dts" + ]; + }; }; boot.tftp = { loadAddress = "0x00A00000"; }; - device.dts = { - src = "${openwrt}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts"; - includes = [ - "${openwrt}/target/linux/ramips/dts" - ]; - }; + kernel = { src = pkgs.fetchurl { diff --git a/devices/qemu/default.nix b/devices/qemu/default.nix index 5c5cc73..33d0faa 100644 --- a/devices/qemu/default.nix +++ b/devices/qemu/default.nix @@ -40,7 +40,7 @@ SERIAL_8250_CONSOLE= "y"; }; }; - device = + hardware = let mac80211 = pkgs.mac80211.override { drivers = ["mac80211_hwsim"]; diff --git a/modules/flashable.nix b/modules/flashable.nix index b444302..77c06d8 100644 --- a/modules/flashable.nix +++ b/modules/flashable.nix @@ -22,7 +22,7 @@ in { }; boot.commandLine = [ - "root=${config.device.rootDevice}" + "root=${config.hardware.rootDevice}" ]; outputs.firmware = let o = config.outputs; in @@ -49,7 +49,7 @@ in { let inherit (pkgs.lib.trivial) toHexString; inherit (pkgs.lib.lists) concatStringsSep; - inherit (config.device) flash; + inherit (config.hardware) flash; in pkgs.buildPackages.runCommand "" {} '' imageSize=$(stat -L -c %s ${config.outputs.firmware}) diff --git a/modules/hardware.nix b/modules/hardware.nix index c8ad81c..f1e78a6 100644 --- a/modules/hardware.nix +++ b/modules/hardware.nix @@ -5,7 +5,7 @@ in { options = { boot = { }; - device = { + hardware = { dts = { src = mkOption { type = types.path; }; includes = mkOption { diff --git a/modules/outputs.nix b/modules/outputs.nix index 81d8441..f2572e3 100644 --- a/modules/outputs.nix +++ b/modules/outputs.nix @@ -24,14 +24,14 @@ in }; dtb = (callPackage ../kernel/dtb.nix {}) { inherit (config.boot) commandLine; - dts = config.device.dts.src; - includes = config.device.dts.includes ++ [ + dts = config.hardware.dts.src; + includes = config.hardware.dts.includes ++ [ "${kernel.headers}/include" ]; }; uimage = (callPackage ../kernel/uimage.nix {}) { commandLine = concatStringsSep " " config.boot.commandLine; - inherit (config.device) loadAddress entryPoint; + inherit (config.hardware) loadAddress entryPoint; inherit kernel; inherit dtb; }; diff --git a/rotuer.nix b/rotuer.nix index dc3b9af..59f2986 100644 --- a/rotuer.nix +++ b/rotuer.nix @@ -83,7 +83,7 @@ in rec { }; }; - services.hostap = hostapd (config.device.networkInterfaces.wlan_24) { + services.hostap = hostapd (config.hardware.networkInterfaces.wlan_24) { params = { ssid = "liminix"; country_code = "GB"; @@ -100,7 +100,7 @@ in rec { }; }; - services.hostap5 = hostapd (config.device.networkInterfaces.wlan_5) { + services.hostap5 = hostapd (config.hardware.networkInterfaces.wlan_5) { params = rec { ssid = "liminix_5"; country_code = "GB"; @@ -142,9 +142,9 @@ in rec { in bundle { name = "bridge-members"; contents = map addif [ - config.device.networkInterfaces.wlan_24 - config.device.networkInterfaces.lan - config.device.networkInterfaces.wlan_5 + config.hardware.networkInterfaces.wlan_24 + config.hardware.networkInterfaces.lan + config.hardware.networkInterfaces.wlan_5 ]; }; @@ -167,7 +167,7 @@ in rec { }; services.wan = - let iface = config.device.networkInterfaces.wan; + let iface = config.hardware.networkInterfaces.wan; in pppoe iface { ppp-options = [ "debug" "+ipv6" "noauth" @@ -213,7 +213,7 @@ in rec { name = "default"; contents = with services; [ loopback - config.device.networkInterfaces.lan + config.hardware.networkInterfaces.lan int bridge hostap diff --git a/tests/wlan/configuration.nix b/tests/wlan/configuration.nix index 36f8462..91300ae 100644 --- a/tests/wlan/configuration.nix +++ b/tests/wlan/configuration.nix @@ -15,7 +15,7 @@ in rec { imports = [ ../../modules/wlan.nix ]; - services.wlan = config.device.networkInterfaces.wlan_24; + services.wlan = config.hardware.networkInterfaces.wlan_24; services.hostap = hostapd (services.wlan) { params = {