{ pkgs, config, userName, ... }:
let
  xmobar = import ./xmobar pkgs.haskellPackages;
  cfg = config.home-manager.users.${userName};
in {
  services = {
    sync-keepass = {
      Service = {
        Type = "oneshot";
        WorkingDirectory = "~";
        ExecStart = "${pkgs.lftp}/bin/lftp -f ${./store.kdbx.lftp}";
      };
    };
    emacs = {
      Unit = {
        After = ["graphical-session-pre.target"];
      };
    };
    trayer = {
      Service = {
        Type = "simple";
        WorkingDirectory = "~";
        ExecStart = "${pkgs.trayer}/bin/trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 8 --tint 0x000000 --alpha 0 --transparent true --height 32 --monitor primary";
        Restart = "always";
      };
      Install = {
        WantedBy = ["graphical-session.target"];
      };
    };
    xmobar = {
      Service = {
        Type = "simple";
        WorkingDirectory = "~";
        ExecStart = "${xmobar}/bin/xmobar";
        Restart = "always";
        Environment = "PATH=${pkgs.worktime}/bin:${pkgs.openssh}/bin";

      };
      Install = {
        WantedBy = ["graphical-session.target"];
      };
    };
    dunst = {
      Service = {
        Restart = "always";
      };
      Install = {
        WantedBy = ["graphical-session.target"];
      };
    };
    xiccd = {
      Service = {
        Type = "simple";
        WorkingDirectory = "~";
        ExecStart = "${pkgs.xiccd}/bin/xiccd";
        Restart = "always";
      };
    };
  };
  timers = {
    sync-keepass = {
      Timer = {
        OnActiveSec = "1m";
        OnUnitActiveSec = "1m";
      };

      Install = {
        WantedBy = ["default.target"];
      };
    };
  };
  targets = {
    graphical-session = {
      Unit = {
        BindsTo = ["default.target"];
        After = ["basic.target"];
      };
    };
  };
}