Skip to content
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

Merged
merged 5 commits into from May 19, 2018
Merged

wireguard-go: init at 0.0.20180514 #40758

merged 5 commits into from May 19, 2018

Conversation

kirelagin
Copy link
Member

Motivation for this change

Userspace implementation of WireGuard.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

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.

@lukateras
Copy link
Member

@GrahamcOfBorg build wireguard-go

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: wireguard-go

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/y966mhl0ag69cdc2szxc0ky2xp892r98-wireguard-go-0.0.20180514-bin/bin
patching script interpreter paths in /nix/store/y966mhl0ag69cdc2szxc0ky2xp892r98-wireguard-go-0.0.20180514-bin
checking for references to /build in /nix/store/y966mhl0ag69cdc2szxc0ky2xp892r98-wireguard-go-0.0.20180514-bin...
shrinking RPATHs of ELF executables and libraries in /nix/store/w8xv0lh682ajyiwaadpa84hk4inqvn8r-wireguard-go-0.0.20180514
strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/w8xv0lh682ajyiwaadpa84hk4inqvn8r-wireguard-go-0.0.20180514
/nix/store/w8xv0lh682ajyiwaadpa84hk4inqvn8r-wireguard-go-0.0.20180514/share/go/src/wireguard-go/tests/netns.sh: interpreter directive changed from "/bin/bash" to "/nix/store/xn5gv3lpfy91yvfy9b0i7klfcxh9xskz-bash-4.4-p19/bin/bash"
/nix/store/w8xv0lh682ajyiwaadpa84hk4inqvn8r-wireguard-go-0.0.20180514/share/go/src/wireguard-go/generate-vendor.sh: interpreter directive changed from "/bin/bash" to "/nix/store/xn5gv3lpfy91yvfy9b0i7klfcxh9xskz-bash-4.4-p19/bin/bash"
checking for references to /build in /nix/store/w8xv0lh682ajyiwaadpa84hk4inqvn8r-wireguard-go-0.0.20180514...
/nix/store/y966mhl0ag69cdc2szxc0ky2xp892r98-wireguard-go-0.0.20180514-bin

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: wireguard-go

Partial log (click to expand)

/private/tmp/nix-build-wireguard-go-0.0.20180514.drv-0
post-installation fixup
strip is /nix/store/kdff2gim6417493yha769kh00n63lnrw-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/nhmb859rvs716s9d0dlfx434v9i3sr01-wireguard-go-0.0.20180514-bin/bin
patching script interpreter paths in /nix/store/nhmb859rvs716s9d0dlfx434v9i3sr01-wireguard-go-0.0.20180514-bin
strip is /nix/store/kdff2gim6417493yha769kh00n63lnrw-cctools-binutils-darwin/bin/strip
patching script interpreter paths in /nix/store/bs2ridpabx9c1vyhqnv4xccsv2djg8cn-wireguard-go-0.0.20180514
/nix/store/bs2ridpabx9c1vyhqnv4xccsv2djg8cn-wireguard-go-0.0.20180514/share/go/src/wireguard-go/generate-vendor.sh: interpreter directive changed from "/bin/bash" to "/nix/store/r8bx3qf1bpncb14i9gzma4vr089pc3pv-bash-4.4-p19/bin/bash"
/nix/store/bs2ridpabx9c1vyhqnv4xccsv2djg8cn-wireguard-go-0.0.20180514/share/go/src/wireguard-go/tests/netns.sh: interpreter directive changed from "/bin/bash" to "/nix/store/r8bx3qf1bpncb14i9gzma4vr089pc3pv-bash-4.4-p19/bin/bash"
/nix/store/nhmb859rvs716s9d0dlfx434v9i3sr01-wireguard-go-0.0.20180514-bin

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: wireguard-go

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/j1gn4f4yxj5fhrf2jszn747gc16zz35x-wireguard-go-0.0.20180514-bin/bin
patching script interpreter paths in /nix/store/j1gn4f4yxj5fhrf2jszn747gc16zz35x-wireguard-go-0.0.20180514-bin
checking for references to /build in /nix/store/j1gn4f4yxj5fhrf2jszn747gc16zz35x-wireguard-go-0.0.20180514-bin...
shrinking RPATHs of ELF executables and libraries in /nix/store/241657cc6q0f4pgn6jj2zlf100jxpmgi-wireguard-go-0.0.20180514
strip is /nix/store/jk6j4lh9v5mvjdbdc35sj0zffhhf6s56-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/241657cc6q0f4pgn6jj2zlf100jxpmgi-wireguard-go-0.0.20180514
/nix/store/241657cc6q0f4pgn6jj2zlf100jxpmgi-wireguard-go-0.0.20180514/share/go/src/wireguard-go/generate-vendor.sh: interpreter directive changed from "/bin/bash" to "/nix/store/l4w7xwjy2nmk31fl5kgyy7gg8z7l9n8z-bash-4.4-p19/bin/bash"
/nix/store/241657cc6q0f4pgn6jj2zlf100jxpmgi-wireguard-go-0.0.20180514/share/go/src/wireguard-go/tests/netns.sh: interpreter directive changed from "/bin/bash" to "/nix/store/l4w7xwjy2nmk31fl5kgyy7gg8z7l9n8z-bash-4.4-p19/bin/bash"
checking for references to /build in /nix/store/241657cc6q0f4pgn6jj2zlf100jxpmgi-wireguard-go-0.0.20180514...
/nix/store/j1gn4f4yxj5fhrf2jszn747gc16zz35x-wireguard-go-0.0.20180514-bin

description = "Userspace Go implementation of WireGuard";
homepage = https://git.zx2c4.com/wireguard-go/about/;
license = licenses.gpl2;
platforms = with platforms; linux ++ darwin ++ windows;
Copy link
Member

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;

Copy link
Member Author

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...

Copy link
Member

@lukateras lukateras May 19, 2018

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 = ''
Copy link
Member

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.

Copy link
Member Author

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 {
Copy link
Member

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).

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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}/@' {} \;
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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;
Copy link
Member

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?

Copy link
Member Author

@kirelagin kirelagin May 19, 2018

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.

@Mic92 Mic92 merged commit d0d9f49 into NixOS:master May 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants