.github
.vscode
docs
hydra
keys
lib
modules
opt
autopull.nix
base.nix
boot.nix
docker.nix
endlessh.nix
fail2ban.nix
generators.nix
kub_net.nix
libs.nix
locale.nix
nix.nix
openssh.nix
pam-fingerprint-swap.nix
plocate.nix
programs.nix
update.nix
systems
users
utils
.envrc
.gitconfig
.gitignore
.sops.yaml
CONTRIBUTING.md
README.md
checks.nix
flake.lock
flake.nix
shell.nix
sops-mergetool.sh
statix.toml
treefmt.toml
63 lines
1.6 KiB
Nix
63 lines
1.6 KiB
Nix
{ lib, config, ... }:
|
|
let
|
|
cfg = config.services.rad-dev.k3s-net;
|
|
in
|
|
{
|
|
options = {
|
|
services.rad-dev.k3s-net = {
|
|
enable = lib.mkOption {
|
|
default = true;
|
|
example = true;
|
|
description = "Whether to enable k3s-net.";
|
|
type = lib.types.bool;
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
system.activationScripts.setZerotierName = lib.stringAfter [ "var" ] ''
|
|
echo "ebe7fbd44565ba9d=ztkubnet" > /var/lib/zerotier-one/devicemap
|
|
'';
|
|
|
|
services.zerotierone = {
|
|
enable = lib.mkDefault true;
|
|
joinNetworks = [ "ebe7fbd44565ba9d" ];
|
|
};
|
|
|
|
systemd.network = {
|
|
enable = lib.mkDefault true;
|
|
wait-online.anyInterface = true;
|
|
netdevs = {
|
|
"20-brkubnet" = {
|
|
netdevConfig = {
|
|
Kind = "bridge";
|
|
Name = "brkubnet";
|
|
};
|
|
};
|
|
};
|
|
networks = {
|
|
"30-ztkubnet" = {
|
|
matchConfig.Name = [ "ztkubnet" ];
|
|
networkConfig.Bridge = "brkubnet";
|
|
linkConfig.RequiredForOnline = "enslaved";
|
|
};
|
|
"40-brkubnet" = {
|
|
matchConfig.Name = "brkubnet";
|
|
bridgeConfig = { };
|
|
networkConfig.LinkLocalAddressing = "no";
|
|
linkConfig.RequiredForOnline = "no";
|
|
};
|
|
"41-vms" = {
|
|
matchConfig.Name = [ "vm-*" ];
|
|
networkConfig.Bridge = "brkubnet";
|
|
linkConfig.RequiredForOnline = "enslaved";
|
|
};
|
|
};
|
|
};
|
|
|
|
# enable experimental networkd backend so networking doesnt break on hybrid systems
|
|
networking.useNetworkd = lib.mkDefault true;
|
|
};
|
|
}
|