ripasso-cursive: cosmetic changes (#361736)
[NixPkgs.git] / pkgs / by-name / po / pomerium-cli / package.nix
blob328717aca5817c8951f4b76d4e4ef2860751e2ad
1 { buildGoModule
2 , fetchFromGitHub
3 , lib
4 }:
6 let
7   inherit (lib) concatStringsSep concatMap id mapAttrsToList;
8 in
9 buildGoModule rec {
10   pname = "pomerium-cli";
11   version = "0.23.0";
13   src = fetchFromGitHub {
14     owner = "pomerium";
15     repo = "cli";
16     rev = "v${version}";
17     sha256 = "sha256-2upvdL8kk0Kbll8UbviyzIX2jdK+tqcHvVlkpz5JjrA=";
18   };
20   vendorHash = "sha256-aQo58i+XuCkdjIg/IPf7kNLXXA0NwZbQMhgWyMb45B4=";
22   subPackages = [
23     "cmd/pomerium-cli"
24   ];
26   ldflags = let
27     # Set a variety of useful meta variables for stamping the build with.
28     setVars = {
29       "github.com/pomerium/cli/version" = {
30         Version = "v${version}";
31         BuildMeta = "nixpkgs";
32         ProjectName = "pomerium-cli";
33         ProjectURL = "github.com/pomerium/cli";
34       };
35     };
36     concatStringsSpace = list: concatStringsSep " " list;
37     mapAttrsToFlatList = fn: list: concatMap id (mapAttrsToList fn list);
38     varFlags = concatStringsSpace (
39       mapAttrsToFlatList (package: packageVars:
40         mapAttrsToList (variable: value:
41           "-X ${package}.${variable}=${value}"
42         ) packageVars
43       ) setVars);
44   in [
45     "${varFlags}"
46   ];
48   installPhase = ''
49     runHook preInstall
51     install -Dm0755 $GOPATH/bin/pomerium-cli $out/bin/pomerium-cli
53     runHook postInstall
54   '';
56   meta = with lib; {
57     homepage = "https://pomerium.io";
58     description = "Client-side helper for Pomerium authenticating reverse proxy";
59     mainProgram = "pomerium-cli";
60     license = licenses.asl20;
61     maintainers = with maintainers; [ lukegb ];
62     platforms = platforms.unix;
63   };