-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
138 lines (123 loc) · 4.35 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{
description = "quake-kube flake";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.gomod2nix.url = "github:nix-community/gomod2nix";
inputs.gomod2nix.inputs.nixpkgs.follows = "nixpkgs";
inputs.gomod2nix.inputs.flake-utils.follows = "flake-utils";
inputs.flocken.url = "github:mirkolenz/flocken/v2";
inputs.flocken.inputs.nixpkgs.follows = "nixpkgs";
outputs = { self, nixpkgs, flake-utils, gomod2nix, flocken }:
(flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ]
(system:
let
pkgs = import nixpkgs {
inherit system;
# needed for terraform
config.allowUnfree = true;
overlays = [
gomod2nix.overlays.default
];
};
# Pinning specific packages.
oldPkgs = import
(builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/9957cd48326fe8dbd52fdc50dd2502307f188b0d.tar.gz";
sha256 = "sha256:1l2hq1n1jl2l64fdcpq3jrfphaz10sd1cpsax3xdya0xgsncgcsi";
})
{
inherit system;
};
# The current default sdk for macOS fails to compile go projects, so we use a newer one for now.
# This has no effect on other platforms.
callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage;
in
rec {
packages.grpc_health_probe = pkgs.buildGoModule rec {
pname = "grpc-health-probe";
version = "0.4.24";
src = pkgs.fetchFromGitHub {
owner = "grpc-ecosystem";
repo = "grpc-health-probe";
rev = "v${version}";
sha256 = "sha256-OZ6vfRYO75kaDVrs/HTZCAPuJyoXOk/p4t85JrLrPwQ=";
};
ldflags = [
"-s"
"-w"
"-X main.versionTag=v${version}"
];
vendorHash = "sha256-4EJBhdHIRLMHCHThwBItF8ZWVJwU+/enq0AkRcP2Wk4=";
nativeCheckInputs = with pkgs; [
];
checkPhase = '''';
meta = with pkgs.lib; {
description = "A command-line tool to perform health-checks for gRPC applications in Kubernetes and elsewhere";
homepage = "https://github.com/grpc-ecosystem/grpc-health-probe";
license = licenses.asl20;
mainProgram = "grpc-health-probe";
};
};
packages.default = pkgs.buildEnv {
name = "quake-kube";
paths = with pkgs; [
packages.q3
packages.grpc_health_probe
ioquake3
];
};
packages.q3 = pkgs.buildGoApplication {
pname = "q3";
version = "0.1";
subPackages = [
"./cmd/q3"
];
src = ./.;
modules = ./gomod2nix.toml;
};
packages.container = pkgs.dockerTools.buildLayeredImage {
name = "quake-kube";
tag = "latest";
created = "now";
contents = [
packages.default
packages.grpc_health_probe
pkgs.ioquake3
];
config.Cmd = [ "${packages.default}/bin/q3" ];
};
legacyPackages.dockerManifest = flocken.legacyPackages.${system}.mkDockerManifest {
github = {
enable = true;
repo = "chrisrx/quake-kube";
token = builtins.getEnv "GITHUB_TOKEN";
};
version = builtins.getEnv "VERSION";
images = with self.packages; [ x86_64-linux.container aarch64-linux.container ];
};
devShells.default =
pkgs.mkShell {
buildInputs = with pkgs; [
pkgs.gomod2nix
go_1_21
gopls
gotools
go-tools
protobuf
oldPkgs.protoc-gen-go # v1.31.0
oldPkgs.protoc-gen-go-grpc # v1.3.0
mdbook
kubernetes-helm
kind
kubectl
tilt
ctlptl
terraform
ioquake3
skopeo
packages.grpc_health_probe
];
};
})
);
}