1{ config, lib, pkgs, ... }:
2
3let
4 serialDevice =
5 if pkgs.stdenv.hostPlatform.isx86
6 then "ttyS0"
7 else "ttyAMA0"; # aarch64
8in {
9 imports = [
10 ./lxc-instance-common.nix
11
12 ../profiles/qemu-guest.nix
13 ];
14
15 config = {
16 system.build.qemuImage = import ../../lib/make-disk-image.nix {
17 inherit pkgs lib config;
18
19 partitionTableType = "efi";
20 format = "qcow2-compressed";
21 copyChannel = true;
22 };
23
24 fileSystems = {
25 "/" = {
26 device = "/dev/disk/by-label/nixos";
27 autoResize = true;
28 fsType = "ext4";
29 };
30 "/boot" = {
31 device = "/dev/disk/by-label/ESP";
32 fsType = "vfat";
33 };
34 };
35
36 boot.growPartition = true;
37 boot.loader.systemd-boot.enable = true;
38
39 # image building needs to know what device to install bootloader on
40 boot.loader.grub.device = "/dev/vda";
41
42 boot.kernelParams = ["console=tty1" "console=${serialDevice}"];
43
44 virtualisation.lxd.agent.enable = lib.mkDefault true;
45 };
46}