add nix-openwrt-imagebuilder
This commit is contained in:
parent
9774b73408
commit
f9ce07f65e
|
@ -92,7 +92,7 @@
|
|||
};
|
||||
};
|
||||
location = "B 2.03.04";
|
||||
model = "tl-wr1043nd-v1";
|
||||
model = "tplink_tl-wr1043nd-v1";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"platform/qca955x_wmac" = {
|
||||
|
@ -160,7 +160,7 @@
|
|||
};
|
||||
};
|
||||
location = "B4.09.01";
|
||||
model = "tl-wr1043nd-v1";
|
||||
model = "tplink_tl-wr1043nd-v1";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"platform/qca955x_wmac" = {
|
||||
|
@ -195,7 +195,7 @@
|
|||
};
|
||||
};
|
||||
location = "Turm C, 2. Etage";
|
||||
model = "tl-wr1043nd-v1";
|
||||
model = "tplink_tl-wr1043nd-v1";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"platform/qca955x_wmac" = {
|
||||
|
@ -295,7 +295,7 @@
|
|||
};
|
||||
};
|
||||
location = "C3D2 Backstage";
|
||||
model = "archer-c7-v2";
|
||||
model = "tplink_archer-c7-v2";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:01/0000:01:00.0" = {
|
||||
|
@ -360,7 +360,7 @@
|
|||
};
|
||||
};
|
||||
location = "Seminarraum, Haus B";
|
||||
model = "unifiac-lite";
|
||||
model = "ubnt_unifiac-lite";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -552,7 +552,7 @@
|
|||
};
|
||||
};
|
||||
location = "B1.05.07";
|
||||
model = "archer-c7-v4";
|
||||
model = "tplink_archer-c7-v4";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -595,7 +595,7 @@
|
|||
};
|
||||
};
|
||||
location = "C3D2 Keller";
|
||||
model = "tl-wdr4300-v1";
|
||||
model = "tplink_tl-wdr4300-v1";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -635,7 +635,7 @@
|
|||
};
|
||||
};
|
||||
location = "B 4.02";
|
||||
model = "tl-wr1043nd-v4";
|
||||
model = "tplink_tl-wr1043nd-v4";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"platform/qca956x_wmac" = {
|
||||
|
@ -665,7 +665,7 @@
|
|||
};
|
||||
};
|
||||
location = "C3D2 Assembly";
|
||||
model = "unifiac-lite";
|
||||
model = "ubnt_unifiac-lite";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -703,7 +703,7 @@
|
|||
};
|
||||
};
|
||||
location = "Auf Lager";
|
||||
model = "unifiac-lite";
|
||||
model = "ubnt_unifiac-lite";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -740,7 +740,7 @@
|
|||
};
|
||||
};
|
||||
location = "C3D2 Podest/Hinterhof";
|
||||
model = "unifiac-lite";
|
||||
model = "ubnt_unifiac-lite";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -776,7 +776,7 @@
|
|||
};
|
||||
};
|
||||
location = "Hof (temporary)";
|
||||
model = "unifiac-lite";
|
||||
model = "ubnt_unifiac-lite";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -874,7 +874,7 @@
|
|||
};
|
||||
};
|
||||
location = "B3.11.01";
|
||||
model = "archer-c7-v5";
|
||||
model = "tplink_archer-c7-v5";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -915,7 +915,7 @@
|
|||
};
|
||||
};
|
||||
location = "ECCE-Raum";
|
||||
model = "archer-c7-v4";
|
||||
model = "tplink_archer-c7-v4";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -989,7 +989,7 @@
|
|||
};
|
||||
};
|
||||
location = "Returned";
|
||||
model = "tl-wr1043nd-v1";
|
||||
model = "tplink_tl-wr1043nd-v1";
|
||||
|
||||
role = "ap";
|
||||
wifi = {
|
||||
|
@ -1022,7 +1022,7 @@
|
|||
};
|
||||
};
|
||||
location = "B4.01";
|
||||
model = "archer-c7-v5";
|
||||
model = "tplink_archer-c7-v5";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -1062,7 +1062,7 @@
|
|||
};
|
||||
};
|
||||
location = "B3.01";
|
||||
model = "archer-c7-v5";
|
||||
model = "tplink_archer-c7-v5";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -1105,7 +1105,7 @@
|
|||
};
|
||||
};
|
||||
location = "Dresden School of Lindy Hop";
|
||||
model = "archer-c7-v5";
|
||||
model = "tplink_archer-c7-v5";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -1142,7 +1142,7 @@
|
|||
};
|
||||
};
|
||||
location = "Saal A vorn";
|
||||
model = "unifi-nanohd";
|
||||
model = "ubnt_unifi-nanohd";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0" = {
|
||||
|
@ -1179,7 +1179,7 @@
|
|||
};
|
||||
};
|
||||
location = "Saal A mitte";
|
||||
model = "unifi-nanohd";
|
||||
model = "ubnt_unifi-nanohd";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0" = {
|
||||
|
@ -1217,7 +1217,7 @@
|
|||
};
|
||||
};
|
||||
location = "Saal A hinten";
|
||||
model = "unifi-nanohd";
|
||||
model = "ubnt_unifi-nanohd";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0" = {
|
||||
|
@ -1256,7 +1256,7 @@
|
|||
};
|
||||
};
|
||||
location = "Saal Foyer";
|
||||
model = "unifi-nanohd";
|
||||
model = "ubnt_unifi-nanohd";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0" = {
|
||||
|
@ -1293,7 +1293,7 @@
|
|||
};
|
||||
};
|
||||
location = "Saal A Kleiner Saal Tuer";
|
||||
model = "unifi-nanohd";
|
||||
model = "ubnt_unifi-nanohd";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0" = {
|
||||
|
@ -1330,7 +1330,7 @@
|
|||
};
|
||||
};
|
||||
location = "Saal A Kabinett";
|
||||
model = "unifi-nanohd";
|
||||
model = "ubnt_unifi-nanohd";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0" = {
|
||||
|
@ -1370,7 +1370,7 @@
|
|||
};
|
||||
};
|
||||
location = "a";
|
||||
model = "tl-wr1043nd-v1";
|
||||
model = "tplink_tl-wr1043nd-v1";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"platform/qca955x_wmac" = {
|
||||
|
@ -1400,7 +1400,7 @@
|
|||
};
|
||||
};
|
||||
location = "Saal A Kleiner Saal Buehne";
|
||||
model = "unifi-nanohd";
|
||||
model = "ubnt_unifi-nanohd";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0" = {
|
||||
|
@ -1441,7 +1441,7 @@
|
|||
};
|
||||
};
|
||||
location = "antrares";
|
||||
model = "archer-c7-v2";
|
||||
model = "tplink_archer-c7-v2";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:01/0000:01:00.0" = {
|
||||
|
@ -1478,7 +1478,7 @@
|
|||
};
|
||||
};
|
||||
location = "Saal (TODO)";
|
||||
model = "unifi-nanohd";
|
||||
model = "ubnt_unifi-nanohd";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0" = {
|
||||
|
@ -1550,7 +1550,7 @@
|
|||
};
|
||||
};
|
||||
location = "B1.05.02";
|
||||
model = "archer-c7-v5";
|
||||
model = "tplink_archer-c7-v5";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -1590,7 +1590,7 @@
|
|||
};
|
||||
};
|
||||
location = "B3.05.03";
|
||||
model = "archer-c7-v5";
|
||||
model = "tplink_archer-c7-v5";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -1630,7 +1630,7 @@
|
|||
};
|
||||
};
|
||||
location = "B4.04.01";
|
||||
model = "archer-c7-v5";
|
||||
model = "tplink_archer-c7-v5";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -1653,7 +1653,7 @@
|
|||
};
|
||||
ap57 = {
|
||||
role = "ap";
|
||||
model = "unifiac-mesh";
|
||||
model = "ubnt_unifiac-mesh";
|
||||
location = "Dach";
|
||||
interfaces = {
|
||||
mgmt = {
|
||||
|
@ -1695,7 +1695,7 @@
|
|||
};
|
||||
ap58 = {
|
||||
role = "ap";
|
||||
model = "unifiac-mesh";
|
||||
model = "ubnt_unifiac-mesh";
|
||||
location = "Coswiger Str.";
|
||||
interfaces = {
|
||||
roof.type = "phys";
|
||||
|
@ -1756,7 +1756,7 @@
|
|||
};
|
||||
};
|
||||
location = "Turm D, Erdgeschoss";
|
||||
model = "archer-c7-v5";
|
||||
model = "tplink_archer-c7-v5";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
@ -1862,7 +1862,7 @@
|
|||
};
|
||||
};
|
||||
location = "Poelzi";
|
||||
model = "tl-wdr4300-v1";
|
||||
model = "tplink_tl-wdr4300-v1";
|
||||
role = "ap";
|
||||
wifi = {
|
||||
"pci0000:00/0000:00:00.0" = {
|
||||
|
|
52
flake.lock
52
flake.lock
|
@ -31,6 +31,20 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1651024496,
|
||||
"narHash": "sha256-uKSrrw/neSkxX6TXPSaMyfu7iKzFrK7F6HOt6vQefGY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d9e593ed5889f3906dc72811c45bf684be8865cf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"openwrt": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -48,11 +62,47 @@
|
|||
"url": "https://git.openwrt.org/openwrt/openwrt.git"
|
||||
}
|
||||
},
|
||||
"openwrt-imagebuilder": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"openwrt": "openwrt_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1651184984,
|
||||
"narHash": "sha256-i6yHFo0isdKtG4hsMwo6rhoqJ/zvnDNX0d+W2ola1vs=",
|
||||
"owner": "astro",
|
||||
"repo": "nix-openwrt-imagebuilder",
|
||||
"rev": "2087eb5f0cd68e15284550124b905105e9ad2ef5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "astro",
|
||||
"repo": "nix-openwrt-imagebuilder",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"openwrt_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1651013664,
|
||||
"narHash": "sha256-efpsYc8KfjIbcD0vdE+VC9tWS471NFAxUB884kJhUEE=",
|
||||
"ref": "master",
|
||||
"rev": "f757a8a09885e3c8bb76371e037b8c0731111980",
|
||||
"revCount": 53988,
|
||||
"type": "git",
|
||||
"url": "https://git.openwrt.org/openwrt/openwrt.git?tag=v21.02.3"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.openwrt.org/openwrt/openwrt.git?tag=v21.02.3"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-master": "nixpkgs-master",
|
||||
"openwrt": "openwrt"
|
||||
"openwrt": "openwrt",
|
||||
"openwrt-imagebuilder": "openwrt-imagebuilder"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
nixpkgs-master.url = "github:NixOS/nixpkgs";
|
||||
openwrt.url = "git+https://git.openwrt.org/openwrt/openwrt.git?ref=openwrt-21.02";
|
||||
openwrt.flake = false;
|
||||
openwrt-imagebuilder.url = "github:astro/nix-openwrt-imagebuilder";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, nixpkgs-master, openwrt }:
|
||||
outputs = inputs@{ self, nixpkgs, nixpkgs-master, openwrt, openwrt-imagebuilder }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
systems = [ system ];
|
||||
|
@ -35,7 +36,7 @@
|
|||
|
||||
# Everything that can be built locally outside of NixOS
|
||||
packages = forAllSystems (system:
|
||||
import ./nix/pkgs { inherit self nixpkgs system; }
|
||||
import ./nix/pkgs { inherit self nixpkgs system openwrt-imagebuilder; }
|
||||
);
|
||||
|
||||
# Configuration for nixosConfigurations
|
||||
|
|
|
@ -20,7 +20,7 @@ let
|
|||
openwrtModel = self.lib.getOpenwrtModel hostConfig.model;
|
||||
|
||||
hasSwitch =
|
||||
if hostConfig.model == "unifiac-mesh"
|
||||
if hostConfig.model == "ubnt_unifiac-mesh"
|
||||
# ours don't come with a switch.
|
||||
then false
|
||||
else
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ self, nixpkgs, system }:
|
||||
{ self, nixpkgs, system, openwrt-imagebuilder }:
|
||||
|
||||
let
|
||||
inherit (self.lib) config;
|
||||
|
@ -77,6 +77,53 @@ let
|
|||
'') (builtins.attrValues rootfs-packages)}
|
||||
'';
|
||||
|
||||
openwrt-images =
|
||||
let
|
||||
profiles = openwrt-imagebuilder.lib.profiles { inherit pkgs; };
|
||||
build = args:
|
||||
openwrt-imagebuilder.lib.build (args // {
|
||||
extraImageName = "zw";
|
||||
packages = [
|
||||
# remove unused default .ipk
|
||||
"-dnsmasq" "-ppp" "-ppp-mod-pppoe" "-odhcp6c" "-odhcpd-ipv6only"
|
||||
# debugging
|
||||
"tcpdump"
|
||||
# monitoring
|
||||
"collectd" "collectd-mod-interface" "collectd-mod-load"
|
||||
"collectd-mod-cpu" "collectd-mod-iwinfo" "collectd-mod-network"
|
||||
];
|
||||
disabledServices = [ "dnsmasq" "uhttpd" ];
|
||||
# TODO: files
|
||||
});
|
||||
in
|
||||
builtins.foldl' (images: hostName:
|
||||
let
|
||||
hostConfig = config.site.hosts.${hostName};
|
||||
matches = profiles.identifyProfiles hostConfig.model;
|
||||
in
|
||||
if matches == []
|
||||
then builtins.trace "${hostName} (${hostConfig.model}) not supported by OpenWRT"
|
||||
images
|
||||
else if builtins.length matches == 1
|
||||
then
|
||||
images // {
|
||||
"${hostName}-image" = build (
|
||||
builtins.elemAt matches 0
|
||||
);
|
||||
}
|
||||
else builtins.trace "${hostName} (${hostConfig.model}) has multiple models!"
|
||||
images // {
|
||||
"${hostName}-image" = build (
|
||||
builtins.elemAt matches 0
|
||||
);
|
||||
}
|
||||
) {} (
|
||||
builtins.attrNames (
|
||||
nixpkgs.lib.filterAttrs (_: { role, ... }: role == "ap")
|
||||
config.site.hosts
|
||||
)
|
||||
);
|
||||
|
||||
device-templates = import ./device-templates.nix {
|
||||
inherit self nixpkgs system;
|
||||
};
|
||||
|
@ -97,7 +144,7 @@ let
|
|||
inherit self nixpkgs system;
|
||||
};
|
||||
in
|
||||
rootfs-packages // vm-packages // device-templates // network-graphs // network-cypher-graphs // starlink // subnetplans // {
|
||||
rootfs-packages // vm-packages // device-templates // openwrt-images // network-graphs // network-cypher-graphs // starlink // subnetplans // {
|
||||
inherit all-rootfs export-openwrt-models export-config dns-slaves
|
||||
encrypt-secrets decrypt-secrets switch-to-production
|
||||
vlan-report
|
||||
|
|
Loading…
Reference in New Issue