# SPDX-FileCopyrightText: 2022 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0

{ depot, lib, pkgs, config, modulesPath, ... }:
{
  imports = [
    "${modulesPath}/profiles/qemu-guest.nix"
  ];

  powerManagement.cpuFreqGovernor = lib.mkDefault "performance";

  fileSystems = {
    "/" = { device = "/dev/mapper/ocivolume-root2"; fsType = "xfs"; };
    "/boot" = { device = "/dev/disk/by-partuuid/31604d5f-fb84-4493-984d-08337314b763"; fsType = "xfs"; };
    "/boot/efi" = { device = "/dev/disk/by-partuuid/a919ce57-0826-446b-b951-53ae09ec3a85"; fsType = "vfat"; };
  };

  nix.settings.max-jobs = lib.mkDefault 20;

  boot.loader.efi.canTouchEfiVariables = true;
  boot.loader.efi.efiSysMountPoint = "/boot/efi";
  boot.loader.systemd-boot.enable = true;

  networking = {
    hostName = "oracle-lon01";
    domain = "as205479.net";
    hostId = "3a5eb800";
    useNetworkd = true;

    nameservers = [
      "2001:4860:4860::8888"
      "2001:4860:4860::8844"
      "8.8.8.8"
      "8.8.4.4"
    ];
    interfaces.enp0s3.useDHCP = true;
    interfaces.enp1s0 = {
      ipv4.addresses = [{ address = "10.0.0.217"; prefixLength = 24; }];
    };
  };
  systemd.network = {
    networks."40-enp0s3".dhcpV4Config = {
      # Use this link as a fallback; it has an IP Google believes to be in IR.
      RouteMetric = 2048;
    };
    networks."40-enp1s0" = {
      dhcpV4Config = {
        RouteMetric = 512;
      };
      routes = [{
        routeConfig = {
          Gateway = "10.0.0.1";
          Destination = "0.0.0.0/0";
          Metric = 512;
        };
      }];
    };
  };
  my.ip.tailscale = "100.93.85.40";
  my.ip.tailscale6 = "fd7a:115c:a1e0:ab12:4843:cd96:625d:5528";
  my.systemType = "aarch64-linux";

  nix.gc.automatic = false;

  system.stateVersion = "22.05";
}