nix-home/home/modules/programs/openconnect-epfl.nix

24 lines
628 B
Nix
Raw Normal View History

2022-09-11 13:34:20 +00:00
{ pkgs, lib, config, ... }:
let
openconnect-epfl = pkgs.writeShellApplication {
name = "openconnect-epfl";
runtimeInputs = with pkgs; [ openconnect rbw ];
text = ''
2024-09-14 12:57:59 +00:00
METHOD="Microsoft Entra ID"
RBW_ENTRY="EPFL Microsoft Auth"
GASPAR_PASSWORD=$(rbw get "$RBW_ENTRY")
GASPAR_TOKEN=$(rbw code "$RBW_ENTRY")
2022-09-11 13:34:20 +00:00
2024-09-14 12:57:59 +00:00
printf "\n%s\n%s\n%s\n" "$METHOD" "$GASPAR_PASSWORD" "$GASPAR_TOKEN" | command sudo openconnect \
2022-09-11 13:34:20 +00:00
--passwd-on-stdin \
2024-09-14 12:57:59 +00:00
-u "pham" \
--useragent='AnyConnect' \
2022-09-11 13:34:20 +00:00
"https://vpn.epfl.ch"
'';
};
in
{
home.packages = [ openconnect-epfl ];
}