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
wireguard-go: init at 0.0.20180514 #40758
Conversation
@GrahamcOfBorg build wireguard-go |
Success on x86_64-linux (full log) Attempted: wireguard-go Partial log (click to expand)
|
Success on x86_64-darwin (full log) Attempted: wireguard-go Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: wireguard-go Partial log (click to expand)
|
description = "Userspace Go implementation of WireGuard"; | ||
homepage = https://git.zx2c4.com/wireguard-go/about/; | ||
license = licenses.gpl2; | ||
platforms = with platforms; linux ++ darwin ++ windows; |
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.
buildGoPackage
sets go.meta.platforms
to all Go packages, and that includes Linux and Darwin:
platforms = go.meta.platforms or lib.platforms.all; |
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 what to make of this. It sets some default platforms for those who are lazy, but we want Windows as well, don’t we? I mean, wireguard-go explicitly supports windows and the fact that go
in nixpkgs
does not is, well, a separate matter...
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.
You are right.
|
||
goDeps = ./deps.nix; | ||
|
||
patchPhase = '' |
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.
Better use postPatch
instead of patchPhase
so that one can still use patches = [ ... ]
to apply custom patches if they want.
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.
✅
|
||
goPackagePath = "wireguard-go"; | ||
|
||
src = fetchurl { |
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.
As far as I know, cgit snapshots are not deterministic, so this should be fetchzip
(that checksums archive contents instead of archive itself).
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 copy-pasted it from the WireGuard expression. Do you think I should fix it in both PRs?
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.
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.
✅
|
||
patchPhase = '' | ||
# Replace local imports so that go tools do not trip on them | ||
find . -name '*.go' -exec sed -i '/import (/,/)/s@"./@"${goPackagePath}/@' {} \; |
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 think you've used the wrong tool to generate deps.nix
. Try dep2nix: https://github.com/nixcloud/dep2nix
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 am pretty sure this has nothing to do with the issue. The problem is that go build
and go install
do not work with relative imports (e.g. https://stackoverflow.com/a/34854318/603094).
I tried dep2nix
nevertheless and the only difference is the header line.
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.
Yes, sorry, commented on the wrong line.
meta = with stdenv.lib; { | ||
description = "Userspace Go implementation of WireGuard"; | ||
homepage = https://git.zx2c4.com/wireguard-go/about/; | ||
license = licenses.gpl2; |
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.
Do you want to maintain this package?
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 can’t promise anything, but now that I think of it, well, yes, I guess I’ll be using it anyway, so I can.
Motivation for this change
Userspace implementation of WireGuard.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)The funny patch is because of #40756, which I don’t know how to handle properly, but patching it this way seemed to be the easiest short-term solution.