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