2022-11-04 12:36:45 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.twingate;
|
2023-07-07 16:50:29 +00:00
|
|
|
in
|
|
|
|
{
|
2022-11-04 12:36:45 +00:00
|
|
|
options.services.twingate = {
|
2023-07-07 16:50:29 +00:00
|
|
|
enable = lib.mkEnableOption "Twingate Client daemon";
|
2023-11-30 18:03:14 +00:00
|
|
|
package = lib.mkPackageOption pkgs "twingate" { };
|
2022-11-04 12:36:45 +00:00
|
|
|
};
|
|
|
|
|
2023-07-07 16:50:29 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
systemd.packages = [ cfg.package ];
|
|
|
|
systemd.services.twingate = {
|
2023-07-21 16:57:57 +00:00
|
|
|
preStart = "cp -r --update=none ${cfg.package}/etc/twingate/. /etc/twingate/";
|
2023-07-07 16:50:29 +00:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
};
|
2022-11-04 12:36:45 +00:00
|
|
|
|
2023-07-07 16:50:29 +00:00
|
|
|
networking.firewall.checkReversePath = lib.mkDefault "loose";
|
2023-08-23 20:01:47 +00:00
|
|
|
services.resolved.enable = lib.mkIf (!config.networking.networkmanager.enable) true;
|
2022-11-04 12:36:45 +00:00
|
|
|
|
2023-07-07 16:50:29 +00:00
|
|
|
environment.systemPackages = [ cfg.package ]; # For the CLI.
|
2022-11-04 12:36:45 +00:00
|
|
|
};
|
|
|
|
}
|