summaryrefslogtreecommitdiff
path: root/modules/server/systemd.nix
blob: 8d0b118c514a8cf38234cdf34f947edb67675bba (plain) (blame)
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
{ secrets, config, ... }:
let
  inherit (config.modules.server) containerEngine;
in
{
  systemd.services.tailscale-up = {
    after = [ "tailscaled.service" ];
    requires = [ "tailscaled.service" ];
    wantedBy = [ "multi-user.target" ];

    serviceConfig = {
      ExecStart = "/run/current-system/sw/bin/tailscale up --authkey ${secrets.tailscale_authentication_key}";
      Restart = "on-failure";
    };
  };

  systemd.services.ghcr-login = {
    after = [ "${containerEngine}.service" ];
    requires = [ "${containerEngine}.service" ];
    wantedBy = [ "multi-user.target" ];

    serviceConfig = {
      ExecStart = "/run/current-system/sw/bin/${containerEngine} login ghcr.io -u ${secrets.ghcr.username} -p ${secrets.ghcr.token}";
      Restart = "on-failure";
    };
  };
}