nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildGoModule,
6}:
7
8buildGoModule (finalAttrs: {
9 pname = "dsnet";
10 version = "0.8.1";
11
12 src = fetchFromGitHub {
13 owner = "naggie";
14 repo = "dsnet";
15 tag = "v${finalAttrs.version}";
16 hash = "sha256-CKDtILZMWFeSU5nTSguM2fi0BCFdvR2LqELIZ6LYOMk=";
17 };
18 vendorHash = "sha256-Q2Ipj9yZ+/GUBEmDvgwFLLww7EXnbvdvj/shGQnh1G8=";
19
20 subPackages = [ "cmd" ];
21
22 postInstall = ''
23 mv $out/bin/cmd $out/bin/dsnet
24 '';
25
26 # The ldflags reduce the executable size by stripping some debug stuff.
27 # The other variables are set so that the output of dsnet version shows the
28 # git ref and the release version from github.
29 # Ref <https://github.com/NixOS/nixpkgs/pull/87383#discussion_r432097657>
30 ldflags = [
31 "-w"
32 "-s"
33 "-X github.com/naggie/dsnet.VERSION=${finalAttrs.src.tag}"
34 "-X github.com/naggie/dsnet.GIT_COMMIT=${finalAttrs.src.tag}"
35 ];
36
37 meta = {
38 description = "Fast command to manage a centralised Wireguard VPN";
39 homepage = "https://github.com/naggie/dsnet";
40 changelog = "https://github.com/naggie/dsnet/releases/tag/${finalAttrs.src.tag}";
41 license = lib.licenses.mit;
42 platforms = lib.platforms.linux;
43 maintainers = [ lib.maintainers.naggie ];
44 mainProgram = "dsnet";
45 };
46
47})