2024-10-05 15:36:52 +00:00
|
|
|
|
2024-10-06 09:03:39 +00:00
|
|
|
{ lib, config, modulesPath, ... }:
|
2024-10-05 15:36:52 +00:00
|
|
|
let
|
|
|
|
cfg = config.bagel.hardware.oracle-vm;
|
|
|
|
inherit (lib) mkEnableOption mkIf mkOption types;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.bagel.hardware.oracle-vm = {
|
|
|
|
enable = mkEnableOption "Oracle's VM hardware defaults";
|
|
|
|
|
|
|
|
system = mkOption {
|
|
|
|
# Only the free Oracle VMs are supported.
|
|
|
|
type = types.enum [ "aarch64-linux" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-10-06 09:03:39 +00:00
|
|
|
# Imports a bunch of virtio modules.
|
|
|
|
imports = [
|
|
|
|
"${modulesPath}/profiles/qemu-guest.nix"
|
|
|
|
];
|
|
|
|
|
2024-10-05 15:36:52 +00:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
boot.loader.systemd-boot.enable = true;
|
|
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
2024-10-06 09:07:25 +00:00
|
|
|
boot.initrd.systemd.enable = true;
|
2024-10-05 15:36:52 +00:00
|
|
|
|
2024-10-06 09:03:39 +00:00
|
|
|
boot.initrd.availableKernelModules = [
|
|
|
|
"xhci_pci" "virtio_pci" "usbhid" "sr_mod"
|
|
|
|
];
|
2024-10-05 15:36:52 +00:00
|
|
|
boot.initrd.kernelModules = [ ];
|
|
|
|
boot.kernelModules = [ ];
|
|
|
|
boot.extraModulePackages = [ ];
|
|
|
|
|
|
|
|
nixpkgs.hostPlatform = cfg.system;
|
|
|
|
|
|
|
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
|
|
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
|
|
|
# still possible to use this option, but it's recommended to use it in conjunction
|
|
|
|
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
|
|
networking.useDHCP = lib.mkDefault false;
|
|
|
|
# Examples:
|
|
|
|
# 2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
|
|
|
|
# link/ether 02:00:17:00:91:6e brd ff:ff:ff:ff:ff:ff
|
|
|
|
# inet 10.0.0.94/24 brd 10.0.0.255 scope global dynamic noprefixroute enp0s3
|
|
|
|
# valid_lft 44162sec preferred_lft 33362sec
|
2024-10-06 09:03:39 +00:00
|
|
|
# inet6 fe80::17ff:fe00:916e/64 scope link
|
2024-10-05 15:36:52 +00:00
|
|
|
# valid_lft forever preferred_lft forever
|
|
|
|
# [root@build02-aarch64-lahfa:~]# ip r
|
|
|
|
# default via 10.0.0.1 dev enp0s3 proto dhcp src 10.0.0.94 metric 1002 mtu 9000
|
|
|
|
networking.interfaces.enp0s3.useDHCP = lib.mkDefault true;
|
|
|
|
};
|
|
|
|
}
|