{ pkgs, ... }:

rec {
  imports = [
    ../../snippets/defaults.nix
    ../../snippets/gammastep.nix
    ../../snippets/kdeconnect.nix
    ../../snippets/ssh.nix
    ../../snippets/zsh.nix
    ../../snippets/taskwarrior.nix
    ../../snippets/kakoune.nix
    ../../snippets/emacs.nix
    ../../snippets/clifm.nix
    ../../snippets/git.nix
    ../../snippets/sway.nix
    ../../snippets/waybar.nix
    # ../../snippets/i3blocks.nix
    # ../../snippets/firefox.nix
    ../../snippets/thunderbird.nix
    ../../snippets/qutebrowser.nix
  ];

  home.username = "alice";
  home.homeDirectory = "/home/alice";
  home.stateVersion = "23.11";

  # Configure default applications
  defaultPrograms = with pkgs; {
    terminal = alacritty;
    editor = kakoune;
    browser = firefox;
    mail = thunderbird;
  };

  # Configure cursor
  home.pointerCursor = {
    package = pkgs.vanilla-dmz;
    name = "Vanilla-DMZ";
    size = 256;
  };

  # Configure icon theme
  gtk = {
    enable = true;
    iconTheme = {
      name = "Papirus";
      package = pkgs.papirus-icon-theme;
    };
  };

  # Configure default apps
  # xdg.mimeApps = {
  #   enable = true;
  #   defaultApplications = {
  #     "application/pdf" = "org.pwmt.zathura.desktop";
  #   };
  # };

  # Install packages
  home.packages = with pkgs;
    let
      archivo = callPackage ../../pkgs/archivo/archivo.nix { };
      nunito = callPackage ../../pkgs/nunito/nunito.nix { };
      highway-gothic = callPackage ../../pkgs/highway-gothic/highway-gothic.nix { };
      olympus = callPackage ../../pkgs/olympus/package.nix { };
      kakmerge = callPackage ../../pkgs/kakmerge/kakmerge.nix { };
      # xdg-terminal-exec = callPackage ../../pkgs/xdg-terminal-exec/xdg-terminal-exec.nix { };
    in
    [ marksman nil ] ++ # Language servers except those installed through package sections
    [ texliveFull texlab ] ++ # LaTeX
    [
      brightnessctl
      grim
      slurp
      wl-clipboard
      blueman
      upower
      glib # provides trash and mount (latter may supplant udisks2?)
      xdg-terminal-exec
      nwg-displays
      kalker
    ] ++ # Basic utilities
    [ bitwarden-cli htop snore hledger hledger-ui ]
    ++ # Personalized selection of command-line (CLI/TUI) apps
    [ defaultPrograms.terminal ] ++ # Terminal emulator
    [
      imv
      vlc
      pavucontrol
      font-manager
    ] ++ # Basic graphical apps
    [
      libreoffice
      geary
      signal-desktop
      element-desktop
      prismlauncher
      mumble
      gimp
      inkscape
      deluge-gtk # Client BitTorrent
      shotwell
      lorien
      keepassxc
      zulip
      filezilla
      bitwarden
      activate-linux
      remmina
    ] ++ # Personalized selection of graphical apps
    [
      olympus
      shticker-book-unwritten
    ] ++ # Games
    [
      noto-fonts
      inter
      redhat-official-fonts
      overpass
      ibm-plex
      rubik
      archivo
      highway-gothic
      merriweather-sans
      paratype-pt-sans
      paratype-pt-serif
      libertinus
      roboto
      lato
      merriweather
      openmoji-black
      openmoji-color
    ] ++ # Fonts
    [
      hunspell
      hunspellDicts.fr-any
      hunspellDicts.fr-moderne
      hunspellDicts.fr-classique
    ] ++ # Spell checking
    # [ papirus-icon-theme ] ++ # Icons
    # [ vanilla-dmz ] ++ # Cursor
    [ keyutils ] ++ # Temp
    [ ];

  programs.home-manager.enable = true;

  programs.swaylock = {
    enable = true;
    settings = { font-size = 14; };
  };
  services.swayidle = {
    enable = true;
    events = [{
      event = "before-sleep";
      command = "${pkgs.lib.getExe pkgs.swaylock} -f";
    }];
  };

  # Fixes electron apps
  home.sessionVariables =
  {
    NIXOS_OZONE_WL = "1";
  };

  # configure fonts correctly
  fonts.fontconfig = {
    enable = true;
    defaultFonts = {
      sansSerif = [ "Rubik" "Noto Sans" "DejaVu Sans" ];
      serif = [ "Noto Serif" "DejaVu Serif" ];
      monospace = [ "Noto Mono" ];
      emoji = [ "OpenMoji" ];
    };
  };

  # terminal emulator
  programs.alacritty.enable = true;

  xdg.desktopEntries.kakoune = {
    name = "Kakoune";
    genericName = "Text Editor";
    comment = "Edit text files";
    icon = "kak";
    exec = "kak %F";
    terminal = true;
    mimeType = [
      "text/english"
      "text/plain"
      "text/x-makefile"
      "text/x-c++hdr"
      "text/x-c++src"
      "text/x-chdr"
      "text/x-csrc"
      "text/x-java"
      "text/x-moc"
      "text/x-pascal"
      "text/x-tcl"
      "text/x-tex"
      "application/x-shellscript"
      "text/x-c"
      "text/x-c++"
      "text/x-devicetree-source"
    ];
    categories = [ "Utility" "TextEditor" ];
  };

  programs.zathura = {
    enable = true;
    options = {
      selection-clipboard = "clipboard";
      synctex = "true";
      synctex-editor-command = "texlab inverse-search -i %{input} -l %{line}";
    };
  };

  programs.pandoc = { enable = true; };

  # Configure notifications
  services.dunst = {
    enable = true;
    settings = {
      global = {
        font = "Rubik 12";
        mouse_left_click = "do_action, close_current";
        mouse_middle_click = "close_all";
        mouse_right_click = "close_current";
      };
    };
  };
  services.batsignal = {
      enable = true;
      extraArgs = [
          "-w 20"
          "-c 10"
          "-d 3"
      ];
  };
}
