{ config, pkgs, lib, user, ... }:

{
  home.packages = with pkgs; [ davmail openfortivpn nomachine-client ];
  programs = {
    git.userEmail = "evie.litherland-smith@ukaea.uk";
    ssh.matchBlocks = {
      "git.ccfe.ac.uk" = { user = "git"; };
      "freia".hostname = "freia020.hpc.l";
      "freia???" = lib.hm.dag.entryAfter [ "freia" ] { hostname = "%h.hpc.l"; };
      "heimdall".hostname = "heimdall003.jet.uk";
      "heimdall???" =
        lib.hm.dag.entryAfter [ "heimdall" ] { hostname = "%h.jet.uk"; };
      "freia* heimdall*" =
        lib.hm.dag.entryAfter [ "freia" "freia???" "heimdall" "heimdall???" ] {
          user = "elitherl";
          compression = true;
        };
    };
    firefox.profiles.default.settings."browser.startup.homepage" =
      "https://nucleus.ukaea.uk";
  };
  programs.mbsync.groups.inboxes.ukaea = [ "INBOX" ];
  accounts = {
    email.accounts = {
      proton.primary = false;
      ukaea = {
        primary = true;
        imapnotify.enable = true;
        mbsync.enable = true;
        msmtp.enable = true;
        mu.enable = true;
      };
    };
    calendar.accounts.ukaea = {
      vdirsyncer.enable = false; # TEMP until fixed
      khal.enable = false; # TEMP until fixed
    };
    contact.accounts.ukaea = {
      vdirsyncer.enable = false; # TEMP until fixed
    };
  };
  services.vdirsyncer.enable = lib.mkForce false; # TEMP until fixed
  services.kanshi.profiles = {
    undocked = {
      outputs = [
        {
          criteria = "eDP-1";
          mode = "1920x1080";
          position = "0,0";
          scale = 1.0;
          status = "enable";
        }
        {
          criteria = "*";
          status = "enable";
        }
      ];
    };
    work = {
      outputs = [
        {
          criteria = "Iiyama North America PLB2403WS 0574281251316";
          position = "0,0";
          status = "enable";
        }
        {
          criteria = "eDP-1";
          status = "disable";
        }
        {
          criteria = "*";
          status = "enable";
        }
      ];
    };
    home = {
      outputs = [
        {
          criteria = "Acer Technologies ED270R TJMEE0043W01";
          position = "0,0";
          status = "enable";
        }
        {
          criteria = "eDP-1";
          status = "disable";
        }
      ];
    };
  };
  xdg.configFile."hypr/extra.conf".text = ''
    misc {
        disable_hyprland_logo = true
        disable_splash_rendering = true
    }

    monitor=eDP-1,preferred,auto,1
    monitor=desc:Iiyama North America PLB2403WS 0574281251316,preferred,0x185,1
    monitor=desc:Dell Inc. DELL U2417H 5K9YD872FY1L,preferred,1920x0,1,transform,1
    monitor=desc:Acer Technologies ED270R TJMEE0043W01,highrr,0x0,1
  '';
}