-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
91 lines (79 loc) · 2.1 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{
description = "Envoy OIDC Authserver";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
utils,
}:
utils.lib.eachDefaultSystem (
system:
let
inherit (nixpkgs) lib;
pkgs = import nixpkgs {
inherit system;
};
devPkgs = with pkgs; [
golangci-lint
buf
delve
git
go_1_23
go-task
golines
goreleaser
gotestsum
glibcLocales
ko
protobuf
protoc-gen-go
watchexec
mkcert
];
in
{
packages = rec {
default = pkgs.buildGo123Module {
pname = "envoy-oidc-authserver";
version = "main";
src = ./.;
ldflags = [ "-s -w" ];
CGO_ENABLED = "0";
meta = {
description = "Envoy OIDC Authserver";
homepage = "https://github.com/shelmangroup/envoy-oidc-authserver";
mainProgram = "envoy-oidc-authserver";
};
# vendorHash = ""; # Use this when upgrading dependencies
vendorHash = "sha256-n7+O+uc8YRnhXccVVnKE6zK8kh8EGiKeiES4A+R1Dhg=";
nativeBuildInputs = with pkgs; [
buf
protoc-gen-go
];
prePatch = ''
HOME="$TMPDIR" ${pkgs.buf}/bin/buf generate
'';
postInstall = ''
${pkgs.upx}/bin/upx $out/bin/envoy-oidc-authserver
'';
};
container = pkgs.dockerTools.buildImage {
name = "envoy-oidc-authserver";
tag = "latest";
copyToRoot = [ default ];
config.Entrypoint = [ "${default}/bin/envoy-oidc-authserver" ];
};
};
devShells = {
default = pkgs.mkShell {
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
packages = devPkgs;
};
};
}
);
}