This repository has been archived on 2024-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
test-installer-configuration/procolixVm.nix

155 lines
3.2 KiB
Nix
Raw Normal View History

2024-11-08 16:15:39 +01:00
{
lib,
config,
modulesPath,
...
}:
2024-11-07 17:10:05 +01:00
let
inherit (lib) mkOption;
inherit (lib.types) types;
in
{
2024-11-08 16:15:39 +01:00
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
2024-11-07 17:10:05 +01:00
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";
};
2024-11-08 16:15:39 +01:00
nameservers = [
"95.215.185.6"
"95.215.185.7"
];
2024-11-07 17:10:05 +01:00
};
########################################################################
## Hardware
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
initrd = {
2024-11-08 16:15:39 +01:00
availableKernelModules = [
"ata_piix"
"uhci_hcd"
"virtio_pci"
"virtio_scsi"
"sd_mod"
"sr_mod"
];
2024-11-07 17:10:05 +01:00
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?
};
}