feat: use mainGateway for idols-ai, rename defaultGateway to proxyGateway

This commit is contained in:
Ryan Yin
2025-08-11 00:31:55 +08:00
parent 01448b6e0e
commit 3c409bd83a
7 changed files with 85 additions and 90 deletions

View File

@@ -7,12 +7,11 @@
let
hostName = "ai"; # Define your hostname.
inherit (myvars.networking) defaultGateway defaultGateway6 nameservers;
inherit (myvars.networking) mainGateway mainGateway6 nameservers;
inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4 ipv6;
ipv4WithMask = "${ipv4}/24";
ipv6WithMask = "${ipv6}/64";
in
{
in {
imports = [
./netdev-mount.nix
# Include the results of the hardware scan.
@@ -50,11 +49,11 @@ in
routes = [
{
Destination = "0.0.0.0/0";
Gateway = defaultGateway;
Gateway = mainGateway;
}
{
Destination = "::/0";
Gateway = defaultGateway6;
Gateway = mainGateway6;
GatewayOnLink = true; # it's a gateway on local link.
}
];

View File

@@ -14,12 +14,13 @@
let
hostName = "aquamarine"; # Define your hostname.
inherit (myvars.networking) defaultGateway defaultGateway6 nameservers;
inherit (myvars.networking) proxyGateway proxyGateway6 nameservers;
inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4;
ipv4WithMask = "${ipv4}/24";
in
{
imports = (mylib.scanPaths ./.) ++ [
in {
imports =
(mylib.scanPaths ./.)
++ [
disko.nixosModules.default
];
@@ -67,11 +68,11 @@ in
routes = [
{
Destination = "0.0.0.0/0";
Gateway = defaultGateway;
Gateway = proxyGateway;
}
{
Destination = "::/0";
Gateway = defaultGateway6;
Gateway = proxyGateway6;
GatewayOnLink = true; # it's a gateway on local link.
}
];

View File

@@ -11,11 +11,10 @@
let
hostName = "kana"; # Define your hostname.
inherit (myvars.networking) defaultGateway defaultGateway6 nameservers;
inherit (myvars.networking) proxyGateway proxyGateway6 nameservers;
inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4;
ipv4WithMask = "${ipv4}/24";
in
{
in {
imports = mylib.scanPaths ./.;
# supported file systems, so we can mount any removable disks with these filesystems
@@ -56,11 +55,11 @@ in
routes = [
{
Destination = "0.0.0.0/0";
Gateway = defaultGateway;
Gateway = proxyGateway;
}
{
Destination = "::/0";
Gateway = defaultGateway6;
Gateway = proxyGateway6;
GatewayOnLink = true; # it's a gateway on local link.
}
];

View File

@@ -11,11 +11,10 @@
let
hostName = "ruby"; # Define your hostname.
inherit (myvars.networking) defaultGateway defaultGateway6 nameservers;
inherit (myvars.networking) proxyGateway proxyGateway6 nameservers;
inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4;
ipv4WithMask = "${ipv4}/24";
in
{
in {
imports = mylib.scanPaths ./.;
# Enable binfmt emulation of aarch64-linux, this is required for cross compilation.
@@ -61,11 +60,11 @@ in
routes = [
{
Destination = "0.0.0.0/0";
Gateway = defaultGateway;
Gateway = proxyGateway;
}
{
Destination = "::/0";
Gateway = defaultGateway6;
Gateway = proxyGateway6;
GatewayOnLink = true; # it's a gateway on local link.
}
];

View File

@@ -3,13 +3,11 @@
hostName,
networking,
...
}:
let
inherit (networking) defaultGateway defaultGateway6 nameservers;
}: let
inherit (networking) proxyGateway proxyGateway6 nameservers;
inherit (networking.hostsAddr.${hostName}) iface ipv4;
ipv4WithMask = "${ipv4}/24";
in
{
in {
# supported file systems, so we can mount any removable disks with these filesystems
boot.supportedFilesystems = [
"ext4"
@@ -42,11 +40,11 @@ in
routes = [
{
Destination = "0.0.0.0/0";
Gateway = defaultGateway;
Gateway = proxyGateway;
}
{
Destination = "::/0";
Gateway = defaultGateway6;
Gateway = proxyGateway6;
GatewayOnLink = true; # it's a gateway on local link.
}
];

View File

@@ -3,13 +3,11 @@
hostName,
networking,
...
}:
let
inherit (networking) defaultGateway defaultGateway6 nameservers;
}: let
inherit (networking) proxyGateway proxyGateway6 nameservers;
inherit (networking.hostsAddr.${hostName}) iface ipv4;
ipv4WithMask = "${ipv4}/24";
in
{
in {
# supported file systems, so we can mount any removable disks with these filesystems
boot.supportedFilesystems = [
"ext4"
@@ -118,11 +116,11 @@ in
routes = [
{
Destination = "0.0.0.0/0";
Gateway = defaultGateway;
Gateway = proxyGateway;
}
{
Destination = "::/0";
Gateway = defaultGateway6;
Gateway = proxyGateway6;
GatewayOnLink = true; # it's a gateway on local link.
}
];

View File

@@ -1,11 +1,10 @@
{ lib }:
rec {
{lib}: rec {
mainGateway = "192.168.5.1"; # main router
mainGateway6 = "fe80::5"; # main router's link-local address
# use suzi as the default gateway
# it's a subrouter with a transparent proxy
defaultGateway = "192.168.5.178";
defaultGateway6 = "fe80::8";
proxyGateway = "192.168.5.178";
proxyGateway6 = "fe80::8";
nameservers = [
# IPv4
"119.29.29.29" # DNSPod
@@ -152,7 +151,8 @@ rec {
};
};
hostsInterface = lib.attrsets.mapAttrs (key: val: {
hostsInterface =
lib.attrsets.mapAttrs (key: val: {
interfaces."${val.iface}" = {
useDHCP = false;
ipv4.addresses = [
@@ -162,7 +162,8 @@ rec {
}
];
};
}) hostsAddr;
})
hostsAddr;
ssh = {
# define the host alias for remote builders
@@ -183,7 +184,8 @@ rec {
HostName ${val.ipv4}
Port 22
''
) "" hostsAddr
) ""
hostsAddr
);
# this config will be written to /etc/ssh/ssh_known_hosts
@@ -209,8 +211,7 @@ rec {
# ==================================== Other SSH Service's Public Key =======================================
# https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints
"github.com".publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl";
"github.com".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl";
};
};
}