feat(*): initialize new Snix infrastructure
Co-Authored-By: edef <edef@edef.eu> Co-Authored-by: Ryan Lahfa <raito@lix.systems> Change-Id: Ica1cda177a236814de900f50a8a61d288f58f519
This commit is contained in:
parent
067eff3427
commit
a52ea3675c
124 changed files with 27723 additions and 1631 deletions
76
ops/modules/hetzner-cloud.nix
Normal file
76
ops/modules/hetzner-cloud.nix
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
let
|
||||
cfg = config.infra.hardware.hetzner-cloud;
|
||||
inherit (lib) types mkOption mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/profiles/qemu-guest.nix") ];
|
||||
|
||||
options.infra.hardware.hetzner-cloud = {
|
||||
enable = mkEnableOption "the Hetzner Cloud hardware profile";
|
||||
|
||||
ipv6 = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
floatingIPs = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.qemuGuest.enable = true;
|
||||
systemd.network.enable = true;
|
||||
networking.useDHCP = lib.mkDefault false;
|
||||
|
||||
systemd.network.networks."10-wan" = {
|
||||
matchConfig.Name = "enp1s0";
|
||||
linkConfig.RequiredForOnline = true;
|
||||
networkConfig = {
|
||||
# DHCPv4 for the IPv4 only.
|
||||
DHCP = "ipv4";
|
||||
Address = [ cfg.ipv6 ] ++ cfg.floatingIPs;
|
||||
};
|
||||
|
||||
routes = [
|
||||
{
|
||||
Gateway = "fe80::1";
|
||||
}
|
||||
];
|
||||
|
||||
dns = [ "2a01:4ff:ff00::add:1" "2a01:4ff:ff00::add:2" ];
|
||||
};
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
|
||||
boot.initrd.kernelModules = [
|
||||
"virtio_balloon"
|
||||
"virtio_console"
|
||||
"virtio_rng"
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"9p"
|
||||
"9pnet_virtio"
|
||||
"ata_piix"
|
||||
"nvme"
|
||||
"sd_mod"
|
||||
"sr_mod"
|
||||
"uhci_hcd"
|
||||
"virtio_blk"
|
||||
"virtio_mmio"
|
||||
"virtio_net"
|
||||
"virtio_pci"
|
||||
"virtio_scsi"
|
||||
"xhci_pci"
|
||||
"ahci"
|
||||
];
|
||||
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue