forked from Fediversity/Fediversity
155 lines
3.2 KiB
Nix
155 lines
3.2 KiB
Nix
{
|
|
lib,
|
|
config,
|
|
modulesPath,
|
|
...
|
|
}:
|
|
|
|
let
|
|
inherit (lib) mkOption;
|
|
inherit (lib.types) types;
|
|
|
|
in
|
|
{
|
|
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
|
|
|
|
options = {
|
|
procolix = {
|
|
vmid = mkOption {
|
|
type = types.str;
|
|
description = ''
|
|
Identifier of the machine. This is a number between 10 and 255, padded
|
|
with zeroes to always be three characters.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = {
|
|
########################################################################
|
|
## Network
|
|
|
|
services.openssh.enable = true;
|
|
|
|
networking = {
|
|
hostName = "fedi${config.procolix.vmid}";
|
|
domain = "procolix.com";
|
|
|
|
interfaces = {
|
|
eth0 = {
|
|
ipv4 = {
|
|
addresses = [
|
|
{
|
|
address = "95.215.187.${config.procolix.vmid}";
|
|
prefixLength = 24;
|
|
}
|
|
];
|
|
};
|
|
ipv6 = {
|
|
addresses = [
|
|
{
|
|
address = "2a00:51c0:13:1305::${config.procolix.vmid}";
|
|
prefixLength = 64;
|
|
}
|
|
];
|
|
};
|
|
};
|
|
};
|
|
|
|
defaultGateway = {
|
|
address = "95.215.187.1";
|
|
interface = "eth0";
|
|
};
|
|
defaultGateway6 = {
|
|
address = "2a00:51c0:13:1305::1";
|
|
interface = "eth0";
|
|
};
|
|
|
|
nameservers = [
|
|
"95.215.185.6"
|
|
"95.215.185.7"
|
|
];
|
|
};
|
|
|
|
########################################################################
|
|
## Hardware
|
|
|
|
boot = {
|
|
loader = {
|
|
systemd-boot.enable = true;
|
|
efi.canTouchEfiVariables = true;
|
|
};
|
|
initrd = {
|
|
availableKernelModules = [
|
|
"ata_piix"
|
|
"uhci_hcd"
|
|
"virtio_pci"
|
|
"virtio_scsi"
|
|
"sd_mod"
|
|
"sr_mod"
|
|
];
|
|
kernelModules = [ "dm-snapshot" ];
|
|
};
|
|
};
|
|
|
|
disko.devices.disk.main = {
|
|
device = "/dev/sda";
|
|
type = "disk";
|
|
|
|
content = {
|
|
type = "gpt";
|
|
|
|
partitions = {
|
|
MBR = {
|
|
priority = 0;
|
|
size = "1M";
|
|
type = "EF02";
|
|
};
|
|
|
|
ESP = {
|
|
priority = 1;
|
|
size = "500M";
|
|
type = "EF00";
|
|
content = {
|
|
type = "filesystem";
|
|
format = "vfat";
|
|
mountpoint = "/boot";
|
|
};
|
|
};
|
|
|
|
root = {
|
|
priority = 2;
|
|
size = "100%";
|
|
content = {
|
|
type = "filesystem";
|
|
format = "ext4";
|
|
mountpoint = "/";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
|
|
########################################################################
|
|
## Miscellaneous
|
|
|
|
services.qemuGuest.enable = true;
|
|
|
|
time.timeZone = "Europe/Amsterdam";
|
|
|
|
i18n.defaultLocale = "en_US.UTF-8";
|
|
|
|
users.users.root.openssh.authorizedKeys.keys = [
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEElREJN0AC7lbp+5X204pQ5r030IbgCllsIxyU3iiKY"
|
|
];
|
|
|
|
nix.extraOptions = ''
|
|
experimental-features = nix-command flakes
|
|
'';
|
|
|
|
system.stateVersion = "24.05"; # Did you read the comment?
|
|
};
|
|
}
|