forked from grafana/loki
-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
155 lines (138 loc) · 4.3 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
{
description = "Grafana Loki";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
# Nixpkgs / NixOS version to use.
outputs = { self, nixpkgs, flake-utils }:
let
golangci-lint-overlay = final: prev: {
golangci-lint = prev.callPackage
"${prev.path}/pkgs/development/tools/golangci-lint"
{
buildGoModule = args:
prev.buildGoModule (args // rec {
version = "1.45.2";
src = prev.fetchFromGitHub rec {
owner = "golangci";
repo = "golangci-lint";
rev = "v${version}";
sha256 =
"sha256-Mr45nJbpyzxo0ZPwx22JW2WrjyjI9FPpl+gZ7NIc6WQ=";
};
vendorSha256 =
"sha256-pcbKg1ePN8pObS9EzP3QYjtaty27L9sroKUs/qEPtJo=";
ldflags = [
"-s"
"-w"
"-X main.version=${version}"
"-X main.commit=v${version}"
"-X main.date=19700101-00:00:00"
];
});
};
};
helm-docs-overlay = final: prev: {
helm-docs = prev.callPackage
"${prev.path}/pkgs/applications/networking/cluster/helm-docs"
{
buildGoModule = args:
prev.buildGoModule (args // rec {
version = "1.11.0";
src = prev.fetchFromGitHub {
owner = "norwoodj";
repo = "helm-docs";
rev = "v${version}";
sha256 = "sha256-476ZhjRwHlNJFkHzY8qQ7WbAUUpFNSoxXLGX9esDA/E=";
};
vendorSha256 = "sha256-xXwunk9rmzZEtqmSo8biuXnAjPp7fqWdQ+Kt9+Di9N8=";
ldflags = [
"-w"
"-s"
"-X main.version=v${version}"
];
});
};
};
nix = import ./nix { inherit self; };
in
{
overlays = {
golangci-lint = golangci-lint-overlay;
helm-docs = helm-docs-overlay;
default = nix.overlay;
};
} //
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
golangci-lint-overlay
helm-docs-overlay
nix.overlay
];
config = { allowUnfree = true; };
};
in
{
# The default package for 'nix build'. This makes sense if the
# flake provides only one package or there is a clear "main"
# package.
defaultPackage = pkgs.loki;
packages = with pkgs; {
inherit
loki
loki-helm-test
loki-helm-test-docker;
};
apps = {
lint = {
type = "app";
program = with pkgs; "${
(writeShellScriptBin "lint.sh" ''
${nixpkgs-fmt}/bin/nixpkgs-fmt --check ${self}/flake.nix ${self}/nix/*.nix
${statix}/bin/statix check ${self}
'')
}/bin/lint.sh";
};
loki = {
type = "app";
program = with pkgs; "${loki.overrideAttrs(old: rec { doCheck = false; })}/bin/loki";
};
promtail = {
type = "app";
program = with pkgs; "${loki.overrideAttrs(old: rec { doCheck = false; })}/bin/promtail";
};
logcli = {
type = "app";
program = with pkgs; "${loki.overrideAttrs(old: rec { doCheck = false; })}/bin/logcli";
};
loki-canary = {
type = "app";
program = with pkgs; "${loki.overrideAttrs(old: rec { doCheck = false; })}/bin/loki-canary";
};
loki-helm-test = {
type = "app";
program = with pkgs; "${loki-helm-test}/bin/helm-test";
};
};
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
gcc
go
systemd
yamllint
nixpkgs-fmt
statix
nettools
golangci-lint
helm-docs
faillint
chart-testing
chart-releaser
];
};
});
}