Skip to content

Commit

Permalink
gp-vpn: reintroduce no-longer supported package (see NixOS/nixpkgs#31…
Browse files Browse the repository at this point in the history
  • Loading branch information
gvolpe committed Oct 6, 2024
1 parent fcf9e0d commit fc5d2e9
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 1 deletion.
4 changes: 3 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@
};

packages.${system} = {
inherit (pkgs) bazecor metals metals-updater zoom-us;
inherit (pkgs) bazecor metals metals-updater;
# crappy software I need for $work
inherit (pkgs) globalprotect-openconnect slack zoom-us;
};
};
}
6 changes: 6 additions & 0 deletions lib/overlays.nix
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ let
pipewireOverlay = f: p: {
pipewire-zoom = inputs.nixpkgs-zoom.legacyPackages.${system}.pipewire;
};

# globalprotect vpn overlay for no-longer supported package
gloabalProtectOverlay = f: p: {
inherit (inputs.nixpkgs-zoom.legacyPackages.${system}) globalprotect-openconnect;
};
in
[
cowsayOverlay
Expand All @@ -113,6 +118,7 @@ in
statix.overlays.default
xargsOverlay
pipewireOverlay
gloabalProtectOverlay
(import ../home/overlays/bat-lvl)
(import ../home/overlays/bazecor)
(import ../home/overlays/hypr-monitor-attached)
Expand Down
1 change: 1 addition & 0 deletions outputs/os.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ in
inherit lib pkgs system;
specialArgs = { inherit inputs; };
modules = [
../system/modules/globalprotectvpn.nix
../system/machine/thinkpad-x1
../system/configuration.nix
extraSystemConfig
Expand Down
57 changes: 57 additions & 0 deletions system/modules/globalprotectvpn.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{ config, lib, pkgs, ... }:

let
cfg = config.services.globalprotectvpn;

execStart =
if cfg.csdWrapper == null then
"${pkgs.globalprotect-openconnect}/bin/gpservice"
else
"${pkgs.globalprotect-openconnect}/bin/gpservice --csd-wrapper=${cfg.csdWrapper}";
in
{
options.services.globalprotectvpn = {
enable = lib.mkEnableOption "globalprotectvpn";

settings = lib.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 = lib.types.attrs;
};

csdWrapper = lib.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 = lib.literalExpression ''"''${pkgs.openconnect}/libexec/openconnect/hipreport.sh"'';
type = lib.types.nullOr lib.types.path;
};
};

config = lib.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" ];
};
};
}

0 comments on commit fc5d2e9

Please sign in to comment.