-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wsl-vpnkit: init at 0.4.1 #238702
wsl-vpnkit: init at 0.4.1 #238702
Conversation
let | ||
version = "0.4.1"; | ||
gvproxyCross = gvproxy.overrideAttrs (_: { | ||
buildPhase = "make cross qemu-wrapper vm"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a common usecase? If so maybe an option or a top-level attr would be a good idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, perhaps, I just checked what was publishing those binaries on their releases and it seems to be that command. Because wsl-vpnkit
was using it from there.
Actually we only need the Windows binary, the vm can be used from the standard gvproxy.
For example this works as well (note this package is from my local packages, hence the strange diff):
diff --git a/packages/wsl-vpnkit/default.nix b/packages/wsl-vpnkit/default.nix
index 807295c..ace87ad 100644
--- a/packages/wsl-vpnkit/default.nix
+++ b/packages/wsl-vpnkit/default.nix
@@ -12,8 +12,10 @@
iputils,
wget,
}: let
- gvproxyCross = gvproxy.overrideAttrs (_: {
- buildPhase = "make cross qemu-wrapper vm";
+ gvproxyWin = gvproxy.overrideAttrs (_: {
+ buildPhase = ''
+ GOARCH=amd64 GOOS=windows go build -ldflags '-s -w' -o bin/gvproxy-windows.exe ./cmd/gvproxy
+ '';
});
in
stdenv.mkDerivation rec {
@@ -31,8 +33,8 @@ in
postPatch = ''
substituteInPlace wsl-vpnkit \
- --replace "/app/wsl-vm" "${gvproxyCross}/bin/vm" \
- --replace "/app/wsl-gvproxy.exe" "${gvproxyCross}/bin/gvproxy-windows.exe"
+ --replace "/app/wsl-vm" "${gvproxy}/bin/vm" \
+ --replace "/app/wsl-gvproxy.exe" "${gvproxyWin}/bin/gvproxy-windows.exe"
'';
installPhase = ''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the PR to only build the gvproxy command for windows inside the buildPhase
. And then I pick the gvforwarder (vm) from the gvproxy package directly.
Do you think it still makes sense to try to merge that into the main package?
fef0575
to
33660c4
Compare
@SuperSandro2000 This is ready for another pass, in the meantime I fixed the following things:
I guess the only open question is regarding the gvproxy windows executable should be an option or go to the top-level. I am not sure who knows could decide such a thing. Personally I know no other use case for it at this point. |
Fine for now :) |
Description of changes
Add the package wsl-vpnkit which can be used to revive network connectivity within WSL when connecting to certain VPN:s that would otherwise break the network within WSL. The main caveat with the packaging was that I could not re-use the nixpkgs
gvproxy
since it needed the Windows version, hence there is an override to cross-compile it and then refer to the produced exe in the wrapper. Script also needs to be run as root.Cross linking previous issue from NixOS-WSL
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)