1 { config, lib, pkgs, ... }:
6 cfg = config.services.globalprotect;
9 if cfg.csdWrapper == null then
10 "${pkgs.globalprotect-openconnect}/bin/gpservice"
12 "${pkgs.globalprotect-openconnect}/bin/gpservice --csd-wrapper=${cfg.csdWrapper}";
16 options.services.globalprotect = {
17 enable = mkEnableOption (lib.mdDoc "globalprotect");
20 description = lib.mdDoc ''
21 GlobalProtect-openconnect configuration. For more information, visit
22 <https://github.com/yuezk/GlobalProtect-openconnect/wiki/Configuration>.
26 "vpn1.company.com" = {
27 openconnect-args = "--script=/path/to/vpnc-script";
33 csdWrapper = mkOption {
34 description = lib.mdDoc ''
35 A script that will produce a Host Integrity Protection (HIP) report,
36 as described at <https://www.infradead.org/openconnect/hip.html>
39 example = literalExpression ''"''${pkgs.openconnect}/libexec/openconnect/hipreport.sh"'';
40 type = types.nullOr types.path;
44 config = mkIf cfg.enable {
45 services.dbus.packages = [ pkgs.globalprotect-openconnect ];
47 environment.etc."gpservice/gp.conf".text = lib.generators.toINI { } cfg.settings;
49 systemd.services.gpservice = {
50 description = "GlobalProtect openconnect DBus service";
53 BusName = "com.yuezk.qt.GPService";
54 ExecStart = execStart;
56 wantedBy = [ "multi-user.target" ];
57 after = [ "network.target" ];