8 cfg = config.services.globalprotect;
11 if cfg.csdWrapper == null then
12 "${pkgs.globalprotect-openconnect}/bin/gpservice"
14 "${pkgs.globalprotect-openconnect}/bin/gpservice --csd-wrapper=${cfg.csdWrapper}";
18 options.services.globalprotect = {
19 enable = lib.mkEnableOption "globalprotect";
21 settings = lib.mkOption {
23 GlobalProtect-openconnect configuration. For more information, visit
24 <https://github.com/yuezk/GlobalProtect-openconnect/wiki/Configuration>.
28 "vpn1.company.com" = {
29 openconnect-args = "--script=/path/to/vpnc-script";
32 type = lib.types.attrs;
35 csdWrapper = lib.mkOption {
37 A script that will produce a Host Integrity Protection (HIP) report,
38 as described at <https://www.infradead.org/openconnect/hip.html>
41 example = lib.literalExpression ''"''${pkgs.openconnect}/libexec/openconnect/hipreport.sh"'';
42 type = lib.types.nullOr lib.types.path;
46 config = lib.mkIf cfg.enable {
47 services.dbus.packages = [ pkgs.globalprotect-openconnect ];
49 environment.etc."gpservice/gp.conf".text = lib.generators.toINI { } cfg.settings;
51 systemd.services.gpservice = {
52 description = "GlobalProtect openconnect DBus service";
55 BusName = "com.yuezk.qt.GPService";
56 ExecStart = execStart;
58 wantedBy = [ "multi-user.target" ];
59 after = [ "network.target" ];