Skip to content

Instantly share code, notes, and snippets.

@superherointj
Created June 15, 2021 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save superherointj/58a69541951de39e739b5a5fb3ea87db to your computer and use it in GitHub Desktop.
Save superherointj/58a69541951de39e739b5a5fb3ea87db to your computer and use it in GitHub Desktop.
Packaging Linkerd - Nixpkgs
{ lib, fetchFromGitHub, buildGoModule }:
buildGoModule rec {
pname = "linkerd";
version = "edge-21.6.2";
src = fetchFromGitHub {
owner = "linkerd";
repo = "linkerd2";
rev = version;
sha256 = "sha256-kgdKH+cIYRg5A3+wrJJ7jcY6Xl206EwBYa37PT3xn1k=";
};
preBuild = ''
go generate ./pkg/charts/static
go generate ./jaeger/static
go generate ./multicluster/static
go generate ./viz/static
'';
buildFlagsArray = [
"-tags=prod"
"-ldflags="
"-s -w"
"-X github.com/linkerd/linkerd2/pkg/version.Version=${version}"
];
vendorSha256 = "sha256-QVLg1ZRsNQPM4lERVHpZLbd+I32JZ1pbGNSGIVTbseg=";
doCheck = true;
deleteVendor = true; # Tried combinations.
runVend = true; # Tried combinations.
subPackages = [ "cli" ];
meta = with lib; {
description = "A service mesh for Kubernetes and beyond";
downloadPage = "https://github.com/linkerd/linkerd2/";
homepage = "https://linkerd.io/";
license = licenses.asl20;
maintainers = with maintainers; [ Gonzih ];
};
}
# To confirm that Linkerd can actually be built properly:
git clone --branch edge-21.6.2 git@github.com:linkerd/linkerd2.git
cd linkerd2
nix-shell -p go
go generate ./pkg/charts/static
go generate ./jaeger/static
go generate ./multicluster/static
go generate ./viz/static
go build -o ./linkerd-cli -tags prod -ldflags "-s -w -X github.com/linkerd/linkerd2/pkg/version.Version=edge-21.6.2" ./cli
# By now, ./linkerd-cli is working just fine.
./linkerd-cli
./linkerd-cli version
@superherointj
Copy link
Author

Solution at: NixOS/nixpkgs#127130

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment