Skip to content

Commit

Permalink
hosts(azure-vm): add
Browse files Browse the repository at this point in the history
  • Loading branch information
xddxdd committed Dec 15, 2024
1 parent 6c1a905 commit 1582b4f
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 35 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions helpers/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ let

patchedNixpkgs = self.packages."${this.system}".pkgs-patched;

cloudLanNetworking = call ./fn/cloud-lan-networking.nix;
container = call ./fn/container.nix;
enumerateList = call ./fn/enumerate-list.nix;
gui = call ./fn/gui.nix;
Expand Down
18 changes: 18 additions & 0 deletions helpers/fn/cloud-lan-networking.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
_: interface: {
networkConfig.DHCP = "yes";
matchConfig.Name = interface;
routes = [
{
Destination = "10.0.0.0/8";
Gateway = "_dhcp4";
}
{
Destination = "172.16.0.0/12";
Gateway = "_dhcp4";
}
{
Destination = "192.168.0.0/16";
Gateway = "_dhcp4";
}
];
}
17 changes: 17 additions & 0 deletions hosts/azure-vm/configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ LT, lib, ... }:
{
imports = [
../../nixos/server.nix

./hardware-configuration.nix
];

systemd.network.networks.eth0 = LT.cloudLanNetworking "eth0";

services.userborn.enable = lib.mkForce false;

services."route-chain" = {
enable = true;
routes = [ "172.22.76.97/29" ];
};
}
33 changes: 33 additions & 0 deletions hosts/azure-vm/hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
_: {
imports = [
../../nixos/hardware/azure.nix
];

boot.loader.grub = {
efiSupport = true;
efiInstallAsRemovable = true;
device = "nodev";
};

fileSystems."/nix" = {
device = "/dev/sda3";
fsType = "btrfs";
options = [
"compress-force=zstd"
"nosuid"
"nodev"
];
};

fileSystems."/boot" = {
device = "/dev/sda2";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
}
20 changes: 20 additions & 0 deletions hosts/azure-vm/host.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ tags, geo, ... }:
{
index = 6;
tags = with tags; [
server
];
city = geo.cities."CN Hong Kong";
hostname = "20.255.249.106";
ssh = {
rsa = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCqZrqspTSB5vmIthx5sFbBHb6enkA2LV/g8BTzRpL0g/ACOQpB9KgTKR/wcbckg+ghhFesgpUf0z6eUmOgh9zx96O+Xi0gc7OiWYxgm7riI12liGRC+3k0O1zhl+9QKzApVW/lGNrc7AfKGB2bZn7sZG0sAwT9v2e+0E3Ze7YOQF103v4bEvpmfKW79fK9+Qezt0QWeU+HPHV3CGyAVhS4zxfeWACLk1mvkSgwO7Zbza9p9ZyARwlGd4dP5bkxsViSj2WWNWixCv9Y7nHhNoFo9+xR2bN7ScdDAZz81E6ZLHbVkPC7omUsX6Q+w6qzwUHyxKeKi87LCjB+M27g2+KnlFRe1qJM6X2SggxeL8RE7tgXJCUD8bVBJAaPKu3Yv5VitLDZl/Kls5OU77xnoU1HavyMlyocq9JiYbjDWL3v3DqgkDXFPS05H9FK53lhuwZDcnkhk6L9XkZEB6uYb4EZQpWjeKPjLYUcSZO3VcT66sQYaF1HGgadx5CxHuX9x8POk5ZIDoAyOPmh12dWQSL67lDUelu0i9JgnV8v7McllG4TxaSa+uMsrdwfxfML+F9gmYmfNHNztII0R2kNYm4Wul8vLrg3aIzgS13MZp2yOc0kEX1LaqhKZ5MnER+tQmivyyWzmilK3+kUCiFvwlzKInl4NPI34wLzLf2h+hSkkQ==";
ed25519 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGqbBvVUqmS5ffYSF/8nLG3M/RCYGm4Ai3JLhxLmQvut";
};
public = {
IPv4 = "20.255.249.106";
};
dn42 = {
IPv4 = "172.22.76.116";
region = 52;
};
}
18 changes: 2 additions & 16 deletions hosts/oracle-vm1/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ ... }:
{ LT, ... }:
{
imports = [
../../nixos/server.nix
Expand All @@ -9,21 +9,7 @@

boot.kernelParams = [ "console=ttyS0,115200" ];

systemd.network.networks.eth0 = {
address = [
"172.18.126.2/24"
"2603:c021:8000:aaaa:2::1/56"
];
gateway = [ "172.18.126.1" ];
networkConfig.DHCP = "ipv6";
matchConfig.Name = "eth0";
routes = [
{
Destination = "10.0.0.0/8";
Gateway = "172.18.126.1";
}
];
};
systemd.network.networks.eth0 = LT.cloudLanNetworking "eth0";

services."route-chain" = {
enable = true;
Expand Down
18 changes: 2 additions & 16 deletions hosts/oracle-vm2/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ ... }:
{ LT, ... }:
{
imports = [
../../nixos/server.nix
Expand All @@ -8,21 +8,7 @@

boot.kernelParams = [ "console=ttyS0,115200" ];

systemd.network.networks.eth0 = {
address = [
"172.18.126.3/24"
"2603:c021:8000:aaaa:3::1/56"
];
gateway = [ "172.18.126.1" ];
networkConfig.DHCP = "ipv6";
matchConfig.Name = "eth0";
routes = [
{
Destination = "10.0.0.0/8";
Gateway = "172.18.126.1";
}
];
};
systemd.network.networks.eth0 = LT.cloudLanNetworking "eth0";

services."route-chain" = {
enable = true;
Expand Down
20 changes: 20 additions & 0 deletions nixos/hardware/azure.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ modulesPath, ... }:
{
imports = [
(modulesPath + "/virtualisation/azure-agent.nix")
];

virtualisation.azure.agent.enable = true;

boot.kernelParams = [
"console=ttyS0"
"earlyprintk=ttyS0"
"rootdelay=300"
];
boot.initrd.kernelModules = [
"hv_vmbus"
"hv_netvsc"
"hv_utils"
"hv_storvsc"
];
}

0 comments on commit 1582b4f

Please sign in to comment.