{
  inputs,
  lib,
  pkgs,
  rice,
  ...
}:
{
  home.stateVersion = "22.11";

  imports = [
    ./modules/cli.nix
    ./modules/desktop.nix
    ./modules/dev.nix
    ./modules/theming.nix
    ./modules/niri.nix
    ./util/ez.nix
    ./util/name.nix
    inputs.nix-index-database.hmModules.nix-index
  ];

  nix.gc = {
    automatic = true;
    frequency = "daily";
    options = "--delete-older-than 3d";
  };

  xdg = {
    enable = true;
    portal =
      let
        gtk = pkgs.xdg-desktop-portal-gtk;
        gnome = pkgs.xdg-desktop-portal-gnome;
      in
      {
        enable = true;
        config = {
          common = {
            default = [
              "gnome"
            ];
          };
        };
        extraPortals = [
          gnome
          gtk
        ];
      };
  };

  home.packages =
    let
      inherit (rice) icons fonts cursor;
    in
    fonts.pkgs
    ++ icons.pkgs
    ++ [
      cursor.package
      pkgs.tauon
    ];

  systemd.user.targets.tray = {
    Unit = {
      Description = "Home Manager System Tray";
      Requires = [ "graphical-session.target" ];
    };
  };

  services.syncthing = {
    enable = true;
  };

  services.udiskie.enable = true;
  # fix reliance on nonexistent graphical-session-pre.target
  systemd.user.services.udiskie = lib.mkForce {
    Unit = {
      Description = "udiskie mount daemon";
      After = [ ];
      PartOf = [ "graphical-session.target" ];
    };

    Service.ExecStart = [ "${pkgs.udiskie}/bin/udiskie --appindicator" ];

    Install.WantedBy = [ "graphical-session.target" ];
  };

  # programs.nix-index-database.comma.enable = true;
  # programs.nix-index = {
  #   enable = true;
  #   enableZshIntegration = false;
  #   enableBashIntegration = false;
  # };
  # programs.command-not-found.enable = false;
  # programs.nix-index.enable = true;

  systemd.user.startServices = "sd-switch";
  ezServices = {
    ckb-next = "${lib.getExe pkgs.ckb-next} -c -b";
  };
}
