summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/systemd.nix
blob: c6ec6f6488fe741ebc721cb973726bdd8f9ed4ce (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{ pkgs, config, userName, ... }:
let
  xmobar = import ./xmobar pkgs.haskellPackages;
  cfg = config.home-manager.users.${userName};
in {
  services = {
    "dynamic-forward@" = {
      Service = {
        WorkingDirectory = "~";
        ExecStart = "${pkgs.autossh}/bin/autossh -M 20000 -- -vN -o ControlMaster=no \"%I\"";
        Environment = [ "AUTOSSH_POLL=30" "AUTOSSH_PIDFILE=.ssh/autossh.%i.pid" ];
        PIDFile = "~/.ssh/autossh.%i.pid";
        Restart = "on-failure";
        RestartSec = "30";
      };
      Install = {
        WantedBy = ["default.target"];
      };
    };
    sync-keepass = {
      Service = {
        Type = "oneshot";
        WorkingDirectory = "~";
        ExecStart = "${pkgs.lftp}/bin/lftp -f ${./store.kdbx.lftp}";
      };
    };
    urxvtd = {
      Service = {
        Type = "simple";
        WorkingDirectory = "~";
        ExecStart = "${cfg.programs.urxvt.package}/bin/urxvtd";
        Restart = "always";
      };
      Unit = {
        After = ["graphical-session.target"];
      };
      Install = {
        WantedBy = ["graphical-session.target"];
      };
    };
    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"];
      };
    };
  };
}