ops/nixos: consolidate Frantech VM configs into lib/frantech.nix

This commit is contained in:
Luke Granger-Brown 2022-01-08 21:49:09 +00:00
parent ad95bffd3d
commit 9472db4577
4 changed files with 68 additions and 139 deletions

View file

@ -7,64 +7,21 @@ let
inherit (depot.ops) secrets; inherit (depot.ops) secrets;
in { in {
imports = [ imports = [
../../../third_party/nixpkgs/nixos/modules/profiles/qemu-guest.nix ../lib/frantech.nix
../lib/low-space.nix
../lib/coredns/default.nix
]; ];
boot.initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"virtio_pci"
"virtio_scsi"
"sr_mod"
"virtio_blk"
];
boot.kernelModules = [ "kvm-amd" ];
# Use GRUB.
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/vda";
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
fileSystems = {
"/" = {
device = "/dev/vda1";
fsType = "ext4";
};
};
nix.maxJobs = lib.mkDefault 1;
# Networking!
networking = { networking = {
hostName = "frantech-las01"; hostName = "frantech-las01";
domain = "as205479.net";
hostId = "2b6a8f37"; hostId = "2b6a8f37";
nameservers = [ defaultGateway.address = "205.185.116.1";
"2001:4860:4860::8888" defaultGateway6.address = "2605:6400:20::1";
"2001:4860:4860::8844"
"8.8.8.8"
"8.8.4.4"
];
defaultGateway = {
address = "205.185.116.1";
interface = "ens3";
};
defaultGateway6 = {
address = "2605:6400:20::1";
interface = "ens3";
};
interfaces.ens3 = { interfaces.ens3 = {
ipv4.addresses = [{ address = "205.185.116.42"; prefixLength = 24; }]; ipv4.addresses = [{ address = "205.185.116.42"; prefixLength = 24; }];
ipv6.addresses = [{ address = "2605:6400:20:179b::1"; prefixLength = 48; }]; ipv6.addresses = [{ address = "2605:6400:20:179b::1"; prefixLength = 48; }];
}; };
}; };
my.ip.tailscale = "100.127.132.77"; my.ip.tailscale = "100.127.132.77";
my.coredns.bind = [ "ens3" "tailscale0" "127.0.0.1" "::1" ];
system.stateVersion = "21.05"; system.stateVersion = "21.05";
} }

View file

@ -7,64 +7,21 @@ let
inherit (depot.ops) secrets; inherit (depot.ops) secrets;
in { in {
imports = [ imports = [
../../../third_party/nixpkgs/nixos/modules/profiles/qemu-guest.nix ../lib/frantech.nix
../lib/low-space.nix
../lib/coredns/default.nix
]; ];
boot.initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"virtio_pci"
"virtio_scsi"
"sr_mod"
"virtio_blk"
];
boot.kernelModules = [ "kvm-amd" ];
# Use GRUB.
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/vda";
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
fileSystems = {
"/" = {
device = "/dev/vda1";
fsType = "ext4";
};
};
nix.maxJobs = lib.mkDefault 1;
# Networking!
networking = { networking = {
hostName = "frantech-lux01"; hostName = "frantech-lux01";
domain = "as205479.net";
hostId = "92a60220"; hostId = "92a60220";
nameservers = [ defaultGateway.address = "107.189.4.1";
"2001:4860:4860::8888" defaultGateway6.address = "2605:6400:30::1";
"2001:4860:4860::8844"
"8.8.8.8"
"8.8.4.4"
];
defaultGateway = {
address = "107.189.4.1";
interface = "ens3";
};
defaultGateway6 = {
address = "2605:6400:30::1";
interface = "ens3";
};
interfaces.ens3 = { interfaces.ens3 = {
ipv4.addresses = [{ address = "107.189.4.182"; prefixLength = 24; }]; ipv4.addresses = [{ address = "107.189.4.182"; prefixLength = 24; }];
ipv6.addresses = [{ address = "2605:6400:30:f1d2::1"; prefixLength = 48; }]; ipv6.addresses = [{ address = "2605:6400:30:f1d2::1"; prefixLength = 48; }];
}; };
}; };
my.ip.tailscale = "100.125.159.57"; my.ip.tailscale = "100.125.159.57";
my.coredns.bind = [ "ens3" "tailscale0" "127.0.0.1" "::1" ];
system.stateVersion = "21.05"; system.stateVersion = "21.05";
} }

View file

@ -8,66 +8,22 @@ let
machineSecrets = secrets.machineSpecific.frantech-nyc01; machineSecrets = secrets.machineSpecific.frantech-nyc01;
in { in {
imports = [ imports = [
../../../third_party/nixpkgs/nixos/modules/profiles/qemu-guest.nix ../lib/frantech.nix
../lib/low-space.nix
../lib/coredns/default.nix
../lib/bgp.nix ../lib/bgp.nix
../lib/minotarproxy.nix
]; ];
boot.initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"virtio_pci"
"virtio_scsi"
"sr_mod"
"virtio_blk"
];
boot.kernelModules = [ "kvm-amd" ];
# Use GRUB.
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/vda";
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
fileSystems = {
"/" = {
device = "/dev/vda1";
fsType = "ext4";
};
};
nix.maxJobs = lib.mkDefault 1;
# Networking!
networking = { networking = {
hostName = "frantech-nyc01"; hostName = "frantech-nyc01";
domain = "as205479.net";
hostId = "251837df"; hostId = "251837df";
nameservers = [ defaultGateway.address = "199.195.254.1";
"2001:4860:4860::8888" defaultGateway6.address = "2605:6400:10::1";
"2001:4860:4860::8844"
"8.8.8.8"
"8.8.4.4"
];
defaultGateway = {
address = "199.195.254.1";
interface = "ens3";
};
defaultGateway6 = {
address = "2605:6400:10::1";
interface = "ens3";
};
interfaces.ens3 = { interfaces.ens3 = {
ipv4.addresses = [{ address = "199.195.254.60"; prefixLength = 24; }]; ipv4.addresses = [{ address = "199.195.254.60"; prefixLength = 24; }];
ipv6.addresses = [{ address = "2605:6400:10:c77::1"; prefixLength = 48; }]; ipv6.addresses = [{ address = "2605:6400:10:c77::1"; prefixLength = 48; }];
}; };
}; };
my.ip.tailscale = "100.99.236.25"; my.ip.tailscale = "100.99.236.25";
my.coredns.bind = [ "ens3" "tailscale0" "127.0.0.1" "::1" ];
services.lukegbgp = let local = { services.lukegbgp = let local = {
asn = 205479; asn = 205479;

View file

@ -0,0 +1,59 @@
# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0
{ depot, lib, pkgs, rebuilder, config, ... }:
let
inherit (depot.ops) secrets;
in {
imports = [
../../../third_party/nixpkgs/nixos/modules/profiles/qemu-guest.nix
../lib/low-space.nix
../lib/coredns/default.nix
];
boot.initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"virtio_pci"
"virtio_scsi"
"sr_mod"
"virtio_blk"
];
boot.kernelModules = [ "kvm-amd" ];
# Use GRUB.
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/vda";
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
fileSystems = {
"/" = {
device = "/dev/vda1";
fsType = "ext4";
};
};
nix.maxJobs = lib.mkDefault 1;
# Networking!
networking = {
domain = "as205479.net";
nameservers = [
"2001:4860:4860::8888"
"2001:4860:4860::8844"
"8.8.8.8"
"8.8.4.4"
];
defaultGateway = {
interface = "ens3";
};
defaultGateway6 = {
interface = "ens3";
};
};
my.coredns.bind = [ "ens3" "tailscale0" "127.0.0.1" "::1" ];
}