2023-10-09 19:29:22 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
serialDevice =
|
|
|
|
if pkgs.stdenv.hostPlatform.isx86
|
|
|
|
then "ttyS0"
|
|
|
|
else "ttyAMA0"; # aarch64
|
|
|
|
in {
|
2024-01-02 11:29:13 +00:00
|
|
|
meta = {
|
|
|
|
maintainers = lib.teams.lxc.members;
|
|
|
|
};
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
imports = [
|
|
|
|
./lxc-instance-common.nix
|
|
|
|
|
|
|
|
../profiles/qemu-guest.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
config = {
|
|
|
|
system.build.qemuImage = import ../../lib/make-disk-image.nix {
|
|
|
|
inherit pkgs lib config;
|
|
|
|
|
|
|
|
partitionTableType = "efi";
|
|
|
|
format = "qcow2-compressed";
|
|
|
|
copyChannel = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems = {
|
|
|
|
"/" = {
|
|
|
|
device = "/dev/disk/by-label/nixos";
|
|
|
|
autoResize = true;
|
|
|
|
fsType = "ext4";
|
|
|
|
};
|
|
|
|
"/boot" = {
|
|
|
|
device = "/dev/disk/by-label/ESP";
|
|
|
|
fsType = "vfat";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
boot.growPartition = true;
|
|
|
|
boot.loader.systemd-boot.enable = true;
|
|
|
|
|
|
|
|
# image building needs to know what device to install bootloader on
|
|
|
|
boot.loader.grub.device = "/dev/vda";
|
|
|
|
|
|
|
|
boot.kernelParams = ["console=tty1" "console=${serialDevice}"];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
services.udev.extraRules = ''
|
|
|
|
SUBSYSTEM=="cpu", CONST{arch}=="x86-64", TEST=="online", ATTR{online}=="0", ATTR{online}="1"
|
|
|
|
'';
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
virtualisation.lxd.agent.enable = lib.mkDefault true;
|
|
|
|
};
|
|
|
|
}
|