ooknet/modules/nixos/server/profiles/linode.nix

94 lines
2.2 KiB
Nix

{
lib,
pkgs,
config,
...
}: let
inherit (builtins) attrValues;
inherit (lib) mkForce getExe' mkIf;
inherit (config.ooknet.server) profile;
in {
config = mkIf (profile == "linode") {
services.qemuGuest.enable = true;
networking = {
tempAddresses = "disabled";
usePredictableInterfaceNames = mkForce false;
interfaces.eth0 = {
tempAddress = "disabled";
useDHCP = true;
};
};
fileSystems."/" = {
device = "/dev/sda";
fsType = "ext4";
autoResize = true;
};
swapDevices = [{device = "/dev/sdb";}];
boot = {
kernelPackages = pkgs.linuxPackages_latest;
kernelModules = [];
# LISH console support
kernelParams = ["console=ttyS0,19200n8"];
extraModulePackages = [];
growPartition = true;
initrd = {
availableKernelModules = [
# modules generated by nixos-generate-config
"virtio_pci"
"virtio_scsi"
"ahci"
"sd_mod"
# qemu guest modules
"virtio_net"
"virtio_mmio"
"virtio_blk"
"virtio_scsi"
"9p"
"9pnet_virtio"
];
kernelModules = [
"virtio_balloon"
"virtio_console"
"virtio_rng"
"virtio_gpu"
];
};
loader = {
grub = {
enable = true;
device = "nodev";
forceInstall = true;
copyKernels = true;
fsIdentifier = "label";
splashImage = null;
extraConfig = ''
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1;
terminal_input serial;
terminal_output serial
'';
extraInstallCommands = "${getExe' pkgs.coreutils "ln"} -fs /boot/grub /boot/grub2";
};
timeout = mkForce 10;
# disable base settings
efi.canTouchEfiVariables = mkForce false;
systemd-boot.enable = mkForce false;
};
};
environment = {
systemPackages = attrValues {
inherit
(pkgs)
inetutils
mtr
sysstat
linode-cli
;
};
};
};
}