{
  configVars,
  outputs,
  lib,

  ...
}: let
  user = "admin";
  merlinIp = configVars.networking.addresses.merlin.ip;
  cloudnixIp = configVars.networking.addresses.cloudnix.ip;
  btrfsMountDevice = "/dev/disk/by-uuid/2aec8052-68fc-4bac-9b8d-c10b9b659ad8";
in {
  imports = [
    # Create users for this host
    ../common/users/${user}

    # Import core options
    ./hardware-configuration.nix
    ../common/core

    # Impermanence
    ../common/optional/persistence.nix
    (import ../common/disks/btrfs/impermanence.nix {
      btrfsMountDevice = btrfsMountDevice;
      lib = lib;
    })

    # Import optional options
    ../common/optional/persistence.nix
    ../common/optional/openssh.nix

    ../common/optional/distributed-builds/local-machine.nix

    outputs.nixosModules.nixosAutoUpgrade
  ];

  boot = {
    loader = {
      efi.canTouchEfiVariables = false;
      grub = {
        enable = true;
        devices = ["/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_57492184"];
      };
    };
  };

  services = {
    earlyoom = {
      enable = true;
      freeMemThreshold = 5; # <%5 free
    };
  };

  system.services.nixosAutoUpgrade = {
    enable = true;
    persistent = true;
    remote = "remotebuild@${merlinIp}";
    reboot = false;
    pushUpdates = false;
    configDir = "/etc/nixos";
    onCalendar = "*-*-* 06:00:00";
    user = "admin";
  };

  networking = {
    hostName = "cloudnix";
    nameservers = ["8.8.8.8"];
    firewall.enable = true;
  };

  systemd.network.networks."10-wan" = {
    networkConfig.DHCP = "no";
    address = [
      "${cloudnixIp}/32"
    ];
    routes = [
      { routeConfig = { Destination = "172.31.1.1"; }; }
      { routeConfig = { Gateway = "172.31.1.1"; GatewayOnLink = true; }; }
    ];
  };

  services.libinput.enable = true;
}