{ lib, machine, pkgs, ... }: {
  imports = [
    ./modules/custom-build-vm.nix
    ./modules/custom-sops-nix.nix
    ./modules/my-users.nix
    ./modules/sddm.nix
    ./modules/unfree.nix
  ];

  config = {
    system.stateVersion = "23.11";

    # Map host keys into VM and launch vm using `virt-viewer`
    virtualisation =
      let
        vmConfig = {
          virtualisation = {
            sharedHostKeys = true;
            sharedUserKeys = true;
            usb-redirect = true;
            virt-viewer = true;
            cores = 4;
            memorySize = 4 * 1024;
          };
        };
      in {
        vmVariant = vmConfig;
        vmVariantWithBootLoader = vmConfig;
      };

    sops = {
      defaultSopsFile = ../secrets/global.yaml;

      age = {
        sshKeyPaths = [
          "/etc/ssh/ssh_host_ed25519_key"
        ];
      };
    };

    boot.loader = {
      efi = {
        canTouchEfiVariables = true;
        efiSysMountPoint = "/boot/efi";
      };
      grub = {
        efiSupport = true;
        device = "nodev";
        useOSProber = true;
      };
    };

    users.myUsers = machine.config.users;

    home-manager = {
      useUserPackages = true;
      useGlobalPkgs = true;

      users =
        lib.attrsets.concatMapAttrs (username: user:
          let
            getUserModule = pkgs.callPackage (import ./utils/user-module.nix);
          in {
            ${username} = (getUserModule {
              inherit machine;
              user = { name = username; } // user;
            });
          })
          machine.config.users;
    };

    # Networking
    networking.hostName = machine.name;

    # Set time zone
    time.timeZone = machine.config.timeZone;

    # Configure keyboard layout
    console.keyMap = machine.config.keyMap;
    services.xserver.xkb.layout = machine.config.keyboardLayout;

    i18n.extraLocaleSettings = machine.config.localeSettings;

    # Enable KDE Plasma
    services.displayManager.sddm = {
      enable = true;
      wayland.enable = true;
    };

    services.desktopManager.plasma6.enable = true;
  };
}