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
+4 -5
View File
@@ -7,12 +7,11 @@
let let
hostName = "ai"; # Define your hostname. 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; inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4 ipv6;
ipv4WithMask = "${ipv4}/24"; ipv4WithMask = "${ipv4}/24";
ipv6WithMask = "${ipv6}/64"; ipv6WithMask = "${ipv6}/64";
in in {
{
imports = [ imports = [
./netdev-mount.nix ./netdev-mount.nix
# Include the results of the hardware scan. # Include the results of the hardware scan.
@@ -50,11 +49,11 @@ in
routes = [ routes = [
{ {
Destination = "0.0.0.0/0"; Destination = "0.0.0.0/0";
Gateway = defaultGateway; Gateway = mainGateway;
} }
{ {
Destination = "::/0"; Destination = "::/0";
Gateway = defaultGateway6; Gateway = mainGateway6;
GatewayOnLink = true; # it's a gateway on local link. GatewayOnLink = true; # it's a gateway on local link.
} }
]; ];
+7 -6
View File
@@ -14,12 +14,13 @@
let let
hostName = "aquamarine"; # Define your hostname. hostName = "aquamarine"; # Define your hostname.
inherit (myvars.networking) defaultGateway defaultGateway6 nameservers; inherit (myvars.networking) proxyGateway proxyGateway6 nameservers;
inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4; inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4;
ipv4WithMask = "${ipv4}/24"; ipv4WithMask = "${ipv4}/24";
in in {
{ imports =
imports = (mylib.scanPaths ./.) ++ [ (mylib.scanPaths ./.)
++ [
disko.nixosModules.default disko.nixosModules.default
]; ];
@@ -67,11 +68,11 @@ in
routes = [ routes = [
{ {
Destination = "0.0.0.0/0"; Destination = "0.0.0.0/0";
Gateway = defaultGateway; Gateway = proxyGateway;
} }
{ {
Destination = "::/0"; Destination = "::/0";
Gateway = defaultGateway6; Gateway = proxyGateway6;
GatewayOnLink = true; # it's a gateway on local link. GatewayOnLink = true; # it's a gateway on local link.
} }
]; ];
+4 -5
View File
@@ -11,11 +11,10 @@
let let
hostName = "kana"; # Define your hostname. hostName = "kana"; # Define your hostname.
inherit (myvars.networking) defaultGateway defaultGateway6 nameservers; inherit (myvars.networking) proxyGateway proxyGateway6 nameservers;
inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4; inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4;
ipv4WithMask = "${ipv4}/24"; ipv4WithMask = "${ipv4}/24";
in in {
{
imports = mylib.scanPaths ./.; imports = mylib.scanPaths ./.;
# supported file systems, so we can mount any removable disks with these filesystems # supported file systems, so we can mount any removable disks with these filesystems
@@ -56,11 +55,11 @@ in
routes = [ routes = [
{ {
Destination = "0.0.0.0/0"; Destination = "0.0.0.0/0";
Gateway = defaultGateway; Gateway = proxyGateway;
} }
{ {
Destination = "::/0"; Destination = "::/0";
Gateway = defaultGateway6; Gateway = proxyGateway6;
GatewayOnLink = true; # it's a gateway on local link. GatewayOnLink = true; # it's a gateway on local link.
} }
]; ];
+4 -5
View File
@@ -11,11 +11,10 @@
let let
hostName = "ruby"; # Define your hostname. hostName = "ruby"; # Define your hostname.
inherit (myvars.networking) defaultGateway defaultGateway6 nameservers; inherit (myvars.networking) proxyGateway proxyGateway6 nameservers;
inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4; inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4;
ipv4WithMask = "${ipv4}/24"; ipv4WithMask = "${ipv4}/24";
in in {
{
imports = mylib.scanPaths ./.; imports = mylib.scanPaths ./.;
# Enable binfmt emulation of aarch64-linux, this is required for cross compilation. # Enable binfmt emulation of aarch64-linux, this is required for cross compilation.
@@ -61,11 +60,11 @@ in
routes = [ routes = [
{ {
Destination = "0.0.0.0/0"; Destination = "0.0.0.0/0";
Gateway = defaultGateway; Gateway = proxyGateway;
} }
{ {
Destination = "::/0"; Destination = "::/0";
Gateway = defaultGateway6; Gateway = proxyGateway6;
GatewayOnLink = true; # it's a gateway on local link. GatewayOnLink = true; # it's a gateway on local link.
} }
]; ];
+5 -7
View File
@@ -3,13 +3,11 @@
hostName, hostName,
networking, networking,
... ...
}: }: let
let inherit (networking) proxyGateway proxyGateway6 nameservers;
inherit (networking) defaultGateway defaultGateway6 nameservers;
inherit (networking.hostsAddr.${hostName}) iface ipv4; inherit (networking.hostsAddr.${hostName}) iface ipv4;
ipv4WithMask = "${ipv4}/24"; ipv4WithMask = "${ipv4}/24";
in in {
{
# supported file systems, so we can mount any removable disks with these filesystems # supported file systems, so we can mount any removable disks with these filesystems
boot.supportedFilesystems = [ boot.supportedFilesystems = [
"ext4" "ext4"
@@ -42,11 +40,11 @@ in
routes = [ routes = [
{ {
Destination = "0.0.0.0/0"; Destination = "0.0.0.0/0";
Gateway = defaultGateway; Gateway = proxyGateway;
} }
{ {
Destination = "::/0"; Destination = "::/0";
Gateway = defaultGateway6; Gateway = proxyGateway6;
GatewayOnLink = true; # it's a gateway on local link. GatewayOnLink = true; # it's a gateway on local link.
} }
]; ];
+5 -7
View File
@@ -3,13 +3,11 @@
hostName, hostName,
networking, networking,
... ...
}: }: let
let inherit (networking) proxyGateway proxyGateway6 nameservers;
inherit (networking) defaultGateway defaultGateway6 nameservers;
inherit (networking.hostsAddr.${hostName}) iface ipv4; inherit (networking.hostsAddr.${hostName}) iface ipv4;
ipv4WithMask = "${ipv4}/24"; ipv4WithMask = "${ipv4}/24";
in in {
{
# supported file systems, so we can mount any removable disks with these filesystems # supported file systems, so we can mount any removable disks with these filesystems
boot.supportedFilesystems = [ boot.supportedFilesystems = [
"ext4" "ext4"
@@ -118,11 +116,11 @@ in
routes = [ routes = [
{ {
Destination = "0.0.0.0/0"; Destination = "0.0.0.0/0";
Gateway = defaultGateway; Gateway = proxyGateway;
} }
{ {
Destination = "::/0"; Destination = "::/0";
Gateway = defaultGateway6; Gateway = proxyGateway6;
GatewayOnLink = true; # it's a gateway on local link. GatewayOnLink = true; # it's a gateway on local link.
} }
]; ];
+10 -9
View File
@@ -1,11 +1,10 @@
{ lib }: {lib}: rec {
rec {
mainGateway = "192.168.5.1"; # main router mainGateway = "192.168.5.1"; # main router
mainGateway6 = "fe80::5"; # main router's link-local address mainGateway6 = "fe80::5"; # main router's link-local address
# use suzi as the default gateway # use suzi as the default gateway
# it's a subrouter with a transparent proxy # it's a subrouter with a transparent proxy
defaultGateway = "192.168.5.178"; proxyGateway = "192.168.5.178";
defaultGateway6 = "fe80::8"; proxyGateway6 = "fe80::8";
nameservers = [ nameservers = [
# IPv4 # IPv4
"119.29.29.29" # DNSPod "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}" = { interfaces."${val.iface}" = {
useDHCP = false; useDHCP = false;
ipv4.addresses = [ ipv4.addresses = [
@@ -162,7 +162,8 @@ rec {
} }
]; ];
}; };
}) hostsAddr; })
hostsAddr;
ssh = { ssh = {
# define the host alias for remote builders # define the host alias for remote builders
@@ -183,7 +184,8 @@ rec {
HostName ${val.ipv4} HostName ${val.ipv4}
Port 22 Port 22
'' ''
) "" hostsAddr ) ""
hostsAddr
); );
# this config will be written to /etc/ssh/ssh_known_hosts # this config will be written to /etc/ssh/ssh_known_hosts
@@ -209,8 +211,7 @@ rec {
# ==================================== Other SSH Service's Public Key ======================================= # ==================================== Other SSH Service's Public Key =======================================
# https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints # https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints
"github.com".publicKey = "github.com".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl";
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl";
}; };
}; };
} }