forked from zentralwerk/network
pkgs/openwrt: install vxlan if needed
This commit is contained in:
parent
d95c54e3c2
commit
747a923774
|
@ -43,10 +43,18 @@ in rec {
|
|||
|
||||
buildImage = hostName:
|
||||
let
|
||||
inherit (config.site.hosts.${hostName}) model;
|
||||
hostConfig = config.site.hosts.${hostName};
|
||||
|
||||
hasVxlan = builtins.any ({ type, ... }:
|
||||
type == "vxlan"
|
||||
) (builtins.attrValues hostConfig.interfaces);
|
||||
|
||||
inherit (hostConfig) model;
|
||||
|
||||
matches = (openwrt-imagebuilder.lib.profiles {
|
||||
inherit pkgs;
|
||||
}).identifyProfiles model;
|
||||
|
||||
fallbackProfile =
|
||||
if model == "dir-615-d"
|
||||
then (openwrt-imagebuilder.lib.profiles {
|
||||
|
@ -67,6 +75,7 @@ in rec {
|
|||
};
|
||||
}
|
||||
else null;
|
||||
|
||||
build = args:
|
||||
openwrt-imagebuilder.lib.build (args // {
|
||||
extraImageName = "zw-${hostName}";
|
||||
|
@ -84,6 +93,8 @@ in rec {
|
|||
# wpa3
|
||||
"-wpad-basic-wolfssl" "-wpad-mini"
|
||||
"wpad-openssl"
|
||||
] ++ nixpkgs.lib.optionals hasVxlan [
|
||||
"vxlan" "kmod-vxlan"
|
||||
] ++ modelPackages.${model} or [];
|
||||
disabledServices = [ "dnsmasq" "uhttpd" ];
|
||||
files = pkgs.runCommandNoCC "image-files" {} ''
|
||||
|
@ -93,14 +104,18 @@ in rec {
|
|||
EOF
|
||||
'';
|
||||
});
|
||||
|
||||
in
|
||||
if matches == [] && fallbackProfile != null
|
||||
then build fallbackProfile
|
||||
|
||||
else if matches == []
|
||||
then builtins.trace "${hostName} (${model}) not supported by OpenWRT"
|
||||
null
|
||||
|
||||
else if builtins.length matches == 1
|
||||
then build (builtins.elemAt matches 0)
|
||||
|
||||
else builtins.trace "${hostName} (${model}) has multiple models!" (
|
||||
build (builtins.elemAt matches 0)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue
Block a user