nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildGoModule,
5 fetchFromGitHub,
6 go,
7 versionCheckHook,
8}:
9
10buildGoModule (finalAttrs: {
11 pname = "kubevpn";
12 version = "2.8.1";
13
14 src = fetchFromGitHub {
15 owner = "KubeNetworks";
16 repo = "kubevpn";
17 tag = "v${finalAttrs.version}";
18 hash = "sha256-+TyaujgbeQXApxmjYvLnmhBZZUeIZMidzS7mL+Ach3o=";
19 };
20
21 vendorHash = null;
22
23 tags = [
24 "noassets" # required to build synthing gui without generating assets
25 ];
26
27 ldflags = [
28 "-X github.com/wencaiwulue/kubevpn/v2/pkg/config.Version=v${finalAttrs.version}"
29 "-X github.com/wencaiwulue/kubevpn/v2/cmd/kubevpn/cmds.OsArch=${go.GOOS}/${go.GOARCH}"
30 ];
31
32 # Resolve configuration tests, which access $HOME
33 preCheck = ''
34 export HOME=$(mktemp -d)
35 '';
36
37 checkFlags =
38 let
39 skippedTests = [
40 # Disable network tests
41 "TestRoute"
42 "TestFunctions"
43 "TestByDumpClusterInfo"
44 "TestByCreateSvc"
45 "TestElegant"
46 ]
47 ++ lib.optionals stdenv.hostPlatform.isDarwin [
48 # Not sure why these test fail on darwin with __darwinAllowLocalNetworking.
49 "TestHttpOverUnix"
50 "TestConnectionRefuse"
51 ];
52 in
53 [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
54
55 __darwinAllowLocalNetworking = true;
56
57 doInstallCheck = true;
58 nativeInstallCheckInputs = [ versionCheckHook ];
59 versionCheckKeepEnvironment = [ "HOME" ];
60 versionCheckProgramArg = "version";
61
62 meta = {
63 changelog = "https://github.com/KubeNetworks/kubevpn/releases/tag/${finalAttrs.src.rev}";
64 description = "Create a VPN and connect to Kubernetes cluster network, access resources, and more";
65 mainProgram = "kubevpn";
66 homepage = "https://github.com/KubeNetworks/kubevpn";
67 license = lib.licenses.mit;
68 maintainers = with lib.maintainers; [ mig4ng ];
69 };
70})