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
This commit is contained in:
Daniel Barlow 2023-03-03 22:52:33 +00:00
parent 263882cbe4
commit e0ea576674
10 changed files with 38 additions and 37 deletions

View file

@ -40,7 +40,7 @@ let
}).config.system; }).config.system;
in { in {
outputs = config.outputs // { 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 # this is just here as a convenience, so that we can get a

View file

@ -87,7 +87,7 @@
inherit (pkgs.pseudofile) dir symlink; inherit (pkgs.pseudofile) dir symlink;
inherit (pkgs.liminix.networking) interface; inherit (pkgs.liminix.networking) interface;
in { in {
device = { hardware = {
defaultOutput = "tftproot"; defaultOutput = "tftproot";
loadAddress = "0x80060000"; loadAddress = "0x80060000";
entryPoint = "0x80060000"; entryPoint = "0x80060000";
@ -96,6 +96,12 @@
size ="0xfa0000"; size ="0xfa0000";
}; };
rootDevice = "1f05"; rootDevice = "1f05";
dts = {
src = "${openwrt}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts";
includes = [
"${openwrt}/target/linux/ath79/dts"
];
};
networkInterfaces = { networkInterfaces = {
lan = interface { device = "eth0"; }; lan = interface { device = "eth0"; };
@ -125,12 +131,6 @@
boot.tftp = { boot.tftp = {
loadAddress = "0x00A00000"; loadAddress = "0x00A00000";
}; };
device.dts = {
src = "${openwrt}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts";
includes = [
"${openwrt}/target/linux/ath79/dts"
];
};
kernel = { kernel = {
src = pkgs.pkgsBuildBuild.fetchurl { src = pkgs.pkgsBuildBuild.fetchurl {
name = "linux.tar.gz"; name = "linux.tar.gz";

View file

@ -21,21 +21,21 @@
hash = "sha256-YYi4gkpLjbOK7bM2MGQjAyEBuXJ9JNXoz/JEmYf8xE8="; hash = "sha256-YYi4gkpLjbOK7bM2MGQjAyEBuXJ9JNXoz/JEmYf8xE8=";
}; };
in { in {
device = { hardware = {
defaultOutput = "tftproot"; defaultOutput = "tftproot";
loadAddress = "0x80000000"; loadAddress = "0x80000000";
entryPoint = "0x80000000"; entryPoint = "0x80000000";
radios = ["rt2800soc"]; radios = ["rt2800soc"];
}; dts = {
boot.tftp = {
loadAddress = "0x00A00000";
};
device.dts = {
src = "${openwrt}/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts"; src = "${openwrt}/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts";
includes = [ includes = [
"${openwrt}/target/linux/ramips/dts" "${openwrt}/target/linux/ramips/dts"
]; ];
}; };
};
boot.tftp = {
loadAddress = "0x00A00000";
};
kernel = { kernel = {
src = pkgs.fetchurl { src = pkgs.fetchurl {

View file

@ -21,21 +21,22 @@
hash = "sha256-YYi4gkpLjbOK7bM2MGQjAyEBuXJ9JNXoz/JEmYf8xE8="; hash = "sha256-YYi4gkpLjbOK7bM2MGQjAyEBuXJ9JNXoz/JEmYf8xE8=";
}; };
in { in {
device = { hardware = {
defaultOutput = "tftproot"; defaultOutput = "tftproot";
loadAddress = "0x80000000"; loadAddress = "0x80000000";
entryPoint = "0x80000000"; entryPoint = "0x80000000";
radios = ["mt7603e"]; radios = ["mt7603e"];
}; dts = {
boot.tftp = {
loadAddress = "0x00A00000";
};
device.dts = {
src = "${openwrt}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts"; src = "${openwrt}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts";
includes = [ includes = [
"${openwrt}/target/linux/ramips/dts" "${openwrt}/target/linux/ramips/dts"
]; ];
}; };
};
boot.tftp = {
loadAddress = "0x00A00000";
};
kernel = { kernel = {
src = pkgs.fetchurl { src = pkgs.fetchurl {

View file

@ -40,7 +40,7 @@
SERIAL_8250_CONSOLE= "y"; SERIAL_8250_CONSOLE= "y";
}; };
}; };
device = hardware =
let let
mac80211 = pkgs.mac80211.override { mac80211 = pkgs.mac80211.override {
drivers = ["mac80211_hwsim"]; drivers = ["mac80211_hwsim"];

View file

@ -22,7 +22,7 @@ in {
}; };
boot.commandLine = [ boot.commandLine = [
"root=${config.device.rootDevice}" "root=${config.hardware.rootDevice}"
]; ];
outputs.firmware = outputs.firmware =
let o = config.outputs; in let o = config.outputs; in
@ -49,7 +49,7 @@ in {
let let
inherit (pkgs.lib.trivial) toHexString; inherit (pkgs.lib.trivial) toHexString;
inherit (pkgs.lib.lists) concatStringsSep; inherit (pkgs.lib.lists) concatStringsSep;
inherit (config.device) flash; inherit (config.hardware) flash;
in in
pkgs.buildPackages.runCommand "" {} '' pkgs.buildPackages.runCommand "" {} ''
imageSize=$(stat -L -c %s ${config.outputs.firmware}) imageSize=$(stat -L -c %s ${config.outputs.firmware})

View file

@ -5,7 +5,7 @@ in {
options = { options = {
boot = { boot = {
}; };
device = { hardware = {
dts = { dts = {
src = mkOption { type = types.path; }; src = mkOption { type = types.path; };
includes = mkOption { includes = mkOption {

View file

@ -24,14 +24,14 @@ in
}; };
dtb = (callPackage ../kernel/dtb.nix {}) { dtb = (callPackage ../kernel/dtb.nix {}) {
inherit (config.boot) commandLine; inherit (config.boot) commandLine;
dts = config.device.dts.src; dts = config.hardware.dts.src;
includes = config.device.dts.includes ++ [ includes = config.hardware.dts.includes ++ [
"${kernel.headers}/include" "${kernel.headers}/include"
]; ];
}; };
uimage = (callPackage ../kernel/uimage.nix {}) { uimage = (callPackage ../kernel/uimage.nix {}) {
commandLine = concatStringsSep " " config.boot.commandLine; commandLine = concatStringsSep " " config.boot.commandLine;
inherit (config.device) loadAddress entryPoint; inherit (config.hardware) loadAddress entryPoint;
inherit kernel; inherit kernel;
inherit dtb; inherit dtb;
}; };

View file

@ -83,7 +83,7 @@ in rec {
}; };
}; };
services.hostap = hostapd (config.device.networkInterfaces.wlan_24) { services.hostap = hostapd (config.hardware.networkInterfaces.wlan_24) {
params = { params = {
ssid = "liminix"; ssid = "liminix";
country_code = "GB"; 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 { params = rec {
ssid = "liminix_5"; ssid = "liminix_5";
country_code = "GB"; country_code = "GB";
@ -142,9 +142,9 @@ in rec {
in bundle { in bundle {
name = "bridge-members"; name = "bridge-members";
contents = map addif [ contents = map addif [
config.device.networkInterfaces.wlan_24 config.hardware.networkInterfaces.wlan_24
config.device.networkInterfaces.lan config.hardware.networkInterfaces.lan
config.device.networkInterfaces.wlan_5 config.hardware.networkInterfaces.wlan_5
]; ];
}; };
@ -167,7 +167,7 @@ in rec {
}; };
services.wan = services.wan =
let iface = config.device.networkInterfaces.wan; let iface = config.hardware.networkInterfaces.wan;
in pppoe iface { in pppoe iface {
ppp-options = [ ppp-options = [
"debug" "+ipv6" "noauth" "debug" "+ipv6" "noauth"
@ -213,7 +213,7 @@ in rec {
name = "default"; name = "default";
contents = with services; [ contents = with services; [
loopback loopback
config.device.networkInterfaces.lan config.hardware.networkInterfaces.lan
int int
bridge bridge
hostap hostap

View file

@ -15,7 +15,7 @@ in rec {
imports = [ ../../modules/wlan.nix ]; imports = [ ../../modules/wlan.nix ];
services.wlan = config.device.networkInterfaces.wlan_24; services.wlan = config.hardware.networkInterfaces.wlan_24;
services.hostap = hostapd (services.wlan) { services.hostap = hostapd (services.wlan) {
params = { params = {