13 inherit (lib) concatStringsSep concatMap id mapAttrsToList;
18 src = fetchFromGitHub {
22 hash = "sha256-JateIiVao5IiPXmphA5+PlzB2XtP6zRR4rURqXSqJ6Q=";
25 vendorHash = "sha256-GdeZkKkENacc11FmEAFUfX9efInfhpv2Lz0/3CtixFQ=";
31 packageJSON = ./package.json;
32 offlineCache = fetchYarnDeps {
33 yarnLock = "${src}/ui/yarn.lock";
34 sha256 = lib.fileContents ./yarn-hash;
45 cp -R deps/pomerium/dist $out
56 # patch pomerium to allow use of external envoy
57 patches = [ ./external-envoy.diff ];
60 # Set a variety of useful meta variables for stamping the build with.
62 "github.com/pomerium/pomerium/internal/version" = {
63 Version = "v${version}";
64 BuildMeta = "nixpkgs";
65 ProjectName = "pomerium";
66 ProjectURL = "github.com/pomerium/pomerium";
68 "github.com/pomerium/pomerium/pkg/envoy" = {
69 OverrideEnvoyPath = "${envoy}/bin/envoy";
72 concatStringsSpace = list: concatStringsSep " " list;
73 mapAttrsToFlatList = fn: list: concatMap id (mapAttrsToList fn list);
74 varFlags = concatStringsSpace (
75 mapAttrsToFlatList (package: packageVars:
76 mapAttrsToList (variable: value:
77 "-X ${package}.${variable}=${value}"
85 # Replace embedded envoy with nothing.
86 # We set OverrideEnvoyPath above, so rawBinary should never get looked at
87 # but we still need to set a checksum/version.
88 rm pkg/envoy/files/files_{darwin,linux}*.go
89 cat <<EOF >pkg/envoy/files/files_external.go
92 import _ "embed" // embed
96 //go:embed envoy.sha256
97 var rawChecksum string
99 //go:embed envoy.version
100 var rawVersion string
102 sha256sum '${envoy}/bin/envoy' > pkg/envoy/files/envoy.sha256
103 echo '${envoy.version}' > pkg/envoy/files/envoy.version
105 # put the built UI files where they will be picked up as part of binary build
106 cp -r ${ui}/* ui/dist
110 install -Dm0755 $GOPATH/bin/pomerium $out/bin/pomerium
115 inherit (nixosTests) pomerium;
116 inherit pomerium-cli;
118 updateScript = ./updater.sh;
122 homepage = "https://pomerium.io";
123 description = "Authenticating reverse proxy";
124 mainProgram = "pomerium";
125 license = licenses.asl20;
126 maintainers = with maintainers; [ lukegb devusb ];
127 platforms = [ "x86_64-linux" "aarch64-linux" ];