1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8let
9 serialDevice = if pkgs.stdenv.hostPlatform.isx86 then "ttyS0" else "ttyAMA0";
10in
11{
12 meta = {
13 maintainers = lib.teams.lxc.members;
14 };
15
16 imports = [
17 ./lxc-instance-common.nix
18
19 ../profiles/qemu-guest.nix
20 ];
21
22 config = {
23 system.build.qemuImage = import ../../lib/make-disk-image.nix {
24 inherit pkgs lib config;
25
26 partitionTableType = "efi";
27 format = "qcow2-compressed";
28 copyChannel = true;
29 };
30
31 fileSystems = {
32 "/" = {
33 device = "/dev/disk/by-label/nixos";
34 autoResize = true;
35 fsType = "ext4";
36 };
37 "/boot" = {
38 device = "/dev/disk/by-label/ESP";
39 fsType = "vfat";
40 };
41 };
42
43 boot.growPartition = true;
44 boot.loader.systemd-boot.enable = true;
45
46 # image building needs to know what device to install bootloader on
47 boot.loader.grub.device = "/dev/vda";
48
49 boot.kernelParams = [
50 "console=tty1"
51 "console=${serialDevice}"
52 ];
53
54 # CPU hotplug
55 services.udev.extraRules = ''
56 SUBSYSTEM=="cpu", CONST{arch}=="x86-64", TEST=="online", ATTR{online}=="0", ATTR{online}="1"
57 '';
58
59 virtualisation.incus.agent.enable = lib.mkDefault true;
60 };
61}