2022-12-17 10:02:37 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.twingate;
|
2023-07-15 17:15:38 +00:00
|
|
|
in
|
|
|
|
{
|
2022-12-17 10:02:37 +00:00
|
|
|
options.services.twingate = {
|
2023-07-15 17:15:38 +00:00
|
|
|
enable = lib.mkEnableOption (lib.mdDoc "Twingate Client daemon");
|
2024-01-02 11:29:13 +00:00
|
|
|
package = lib.mkPackageOption pkgs "twingate" { };
|
2022-12-17 10:02:37 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
systemd.packages = [ cfg.package ];
|
|
|
|
systemd.services.twingate = {
|
2023-08-04 22:07:22 +00:00
|
|
|
preStart = "cp -r --update=none ${cfg.package}/etc/twingate/. /etc/twingate/";
|
2023-07-15 17:15:38 +00:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
};
|
2022-12-17 10:02:37 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
networking.firewall.checkReversePath = lib.mkDefault "loose";
|
2023-10-09 19:29:22 +00:00
|
|
|
services.resolved.enable = lib.mkIf (!config.networking.networkmanager.enable) true;
|
2022-12-17 10:02:37 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
environment.systemPackages = [ cfg.package ]; # For the CLI.
|
2022-12-17 10:02:37 +00:00
|
|
|
};
|
|
|
|
}
|