···11-{ ... }: { }
11+{ pkgs, ... }:
22+{
33+ users.users.mou.packages = with pkgs; [
44+ (writeShellScriptBin "ksu-vpn" ''
55+ # Ask for sudo password before doing anything
66+ sudo -v
77+88+ # Get the cookie
99+ cookie=$(${pkgs.gpauth}/bin/gpauth -q --default-browser vpn.kennesaw.edu)
1010+1111+ # Connect to the vpn
1212+ printf '%s\n' "$cookie" | sudo ${pkgs.gpclient}/bin/gpclient connect vpn.kennesaw.edu \
1313+ --csd-wrapper ${pkgs.openconnect}/libexec/openconnect/hipreport.sh \
1414+ --cookie-on-stdin &
1515+1616+ # I don't like this, but it doesn't seem like gpclient has a way to run scripts after a connection is established
1717+ # and I need to make sure that dns-over-tls is disabled for connections to work.
1818+ sleep 5
1919+ sudo resolvectl dnsovertls tun0 no
2020+2121+ # Can either Ctrl + C to exit or run `sudo gpclient disconnect`
2222+ wait
2323+ '')
2424+ gpclient
2525+ ];
2626+}