mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-12 07:32:40 +02:00
feat: use mainGateway for idols-ai, rename defaultGateway to proxyGateway
This commit is contained in:
@@ -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.
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -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.
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -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.
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -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.
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -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.
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -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
@@ -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";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user