1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8let
9 cfg = config.oci;
10in
11{
12 imports = [ ../profiles/qemu-guest.nix ];
13
14 # Taken from /proc/cmdline of Ubuntu 20.04.2 LTS on OCI
15 boot.kernelParams = [
16 "nvme.shutdown_timeout=10"
17 "nvme_core.shutdown_timeout=10"
18 "libiscsi.debug_libiscsi_eh=1"
19 "crash_kexec_post_notifiers"
20
21 # VNC console
22 "console=tty1"
23
24 # x86_64-linux
25 "console=ttyS0"
26
27 # aarch64-linux
28 "console=ttyAMA0,115200"
29 ];
30
31 boot.growPartition = true;
32
33 fileSystems."/" = {
34 device = "/dev/disk/by-label/nixos";
35 fsType = "ext4";
36 autoResize = true;
37 };
38
39 fileSystems."/boot" = lib.mkIf cfg.efi {
40 device = "/dev/disk/by-label/ESP";
41 fsType = "vfat";
42 };
43
44 boot.loader.efi.canTouchEfiVariables = false;
45 boot.loader.grub = {
46 device = if cfg.efi then "nodev" else "/dev/sda";
47 splashImage = null;
48 extraConfig = ''
49 serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
50 terminal_input --append serial
51 terminal_output --append serial
52 '';
53 efiInstallAsRemovable = cfg.efi;
54 efiSupport = cfg.efi;
55 };
56
57 # https://docs.oracle.com/en-us/iaas/Content/Compute/Tasks/configuringntpservice.htm#Configuring_the_Oracle_Cloud_Infrastructure_NTP_Service_for_an_Instance
58 networking.timeServers = [ "169.254.169.254" ];
59
60 services.openssh.enable = true;
61
62 # Otherwise the instance may not have a working network-online.target,
63 # making the fetch-ssh-keys.service fail
64 networking.useNetworkd = lib.mkDefault true;
65}