@@ -0,0 +1,58 @@
1+{ buildGoModule
2+, fetchFromGitHub
3+, lib
4+, pomerium
5+}:
6+
7+let
8+ inherit (lib) concatStringsSep concatMap id mapAttrsToList;
9+in
10+buildGoModule rec {
11+ pname = "pomerium-cli";
12+ version = pomerium.version;
13+ src = fetchFromGitHub {
14+ owner = "pomerium";
15+ repo = "cli";
16+ rev = "v${version}";
17+ hash = "sha256:0230b22xjnpykj8bcdahzzlsvlrd63z2cmg6yb246c5ngjs835q1";
18+ };
19+
20+ vendorSha256 = "sha256:0xx22lmh6wip1d1bjrp4lgab3q9yilw54v4lg24lf3xhbsr5si9b";
21+ subPackages = [
22+ "cmd/pomerium-cli"
23+ ];
24+
25+ ldflags = let
26+ # Set a variety of useful meta variables for stamping the build with.
27+ setVars = {
28+ "github.com/pomerium/cli/version" = {
29+ Version = "v${version}";
30+ BuildMeta = "nixpkgs";
31+ ProjectName = "pomerium-cli";
32+ ProjectURL = "github.com/pomerium/cli";
33+ };
34+ };
35+ concatStringsSpace = list: concatStringsSep " " list;
36+ mapAttrsToFlatList = fn: list: concatMap id (mapAttrsToList fn list);
37+ varFlags = concatStringsSpace (
38+ mapAttrsToFlatList (package: packageVars:
39+ mapAttrsToList (variable: value:
40+ "-X ${package}.${variable}=${value}"
41+ ) packageVars
42+ ) setVars);
43+ in [
44+ "${varFlags}"
45+ ];
46+
47+ installPhase = ''
48+ install -Dm0755 $GOPATH/bin/pomerium-cli $out/bin/pomerium-cli
49+ '';
50+
51+ meta = with lib; {
52+ homepage = "https://pomerium.io";
53+ description = "Client-side helper for Pomerium authenticating reverse proxy";
54+ license = licenses.asl20;
55+ maintainers = with maintainers; [ lukegb ];
56+ platforms = platforms.unix;
57+ };
58+}