6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
60 lines
1.6 KiB
Nix
60 lines
1.6 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.globalprotect;
|
|
|
|
execStart =
|
|
if cfg.csdWrapper == null then
|
|
"${pkgs.globalprotect-openconnect}/bin/gpservice"
|
|
else
|
|
"${pkgs.globalprotect-openconnect}/bin/gpservice --csd-wrapper=${cfg.csdWrapper}";
|
|
in
|
|
|
|
{
|
|
options.services.globalprotect = {
|
|
enable = mkEnableOption "globalprotect";
|
|
|
|
settings = mkOption {
|
|
description = ''
|
|
GlobalProtect-openconnect configuration. For more information, visit
|
|
<https://github.com/yuezk/GlobalProtect-openconnect/wiki/Configuration>.
|
|
'';
|
|
default = { };
|
|
example = {
|
|
"vpn1.company.com" = {
|
|
openconnect-args = "--script=/path/to/vpnc-script";
|
|
};
|
|
};
|
|
type = types.attrs;
|
|
};
|
|
|
|
csdWrapper = mkOption {
|
|
description = ''
|
|
A script that will produce a Host Integrity Protection (HIP) report,
|
|
as described at <https://www.infradead.org/openconnect/hip.html>
|
|
'';
|
|
default = null;
|
|
example = literalExpression ''"''${pkgs.openconnect}/libexec/openconnect/hipreport.sh"'';
|
|
type = types.nullOr types.path;
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
services.dbus.packages = [ pkgs.globalprotect-openconnect ];
|
|
|
|
environment.etc."gpservice/gp.conf".text = lib.generators.toINI { } cfg.settings;
|
|
|
|
systemd.services.gpservice = {
|
|
description = "GlobalProtect openconnect DBus service";
|
|
serviceConfig = {
|
|
Type = "dbus";
|
|
BusName = "com.yuezk.qt.GPService";
|
|
ExecStart = execStart;
|
|
};
|
|
wantedBy = [ "multi-user.target" ];
|
|
after = [ "network.target" ];
|
|
};
|
|
};
|
|
}
|