summaryrefslogtreecommitdiff
path: root/home/environ/units.nix
blob: ae4e680b3fcf52cc6761a0b200700a961c5dcdaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
  config,
  lib,
  pkgs,
  ...
}:
with lib; let
  cfg = config.local.environ;
in {
  config = mkIf cfg.enable {
    systemd.user = {
      timers = {
        units-cur = {
          Install.WantedBy = ["timers.target"];
          Timer.OnCalendar = "daily";
          Unit.Description = "Update currency information for 'units'";
        };
      };

      services = {
        units-cur = {
          Unit.Description = "Update currency information for 'units'";

          Service = {
            Type = "exec";
            ExecStart = "${pkgs.units}/bin/units_cur .units";
          };
        };
      };
    };

    home.file = {
      #TODO: .calc_history
      ".units_history".source = config.lib.file.mkOutOfStoreSymlink "/dev/null";
    };
  };
}