-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
Copy pathdefault.nix
92 lines (79 loc) · 2.35 KB
/
default.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
{ self }:
{
overlay = final: prev:
let
# self.rev is only set on a clean git tree
gitRevision = if (self ? rev) then self.rev else "dirty";
shortGitRevsion = with prev.lib;
if (self ? rev) then
(strings.concatStrings
(lists.take 8 (strings.stringToCharacters gitRevision)))
else
"dirty";
# the image tag script is hard coded to take only 7 characters
imageTagVersion = with prev.lib;
if (self ? rev) then
(strings.concatStrings
(lists.take 8 (strings.stringToCharacters gitRevision)))
else
"dirty";
imageTag =
if (self ? rev) then
"${imageTagVersion}"
else
"${imageTagVersion}-WIP";
loki-helm-test = prev.callPackage ../production/helm/loki/src/helm-test {
inherit (prev) pkgs lib buildGoModule dockerTools;
rev = gitRevision;
};
in
{
inherit (loki-helm-test) loki-helm-test loki-helm-test-docker;
} // rec {
loki = prev.callPackage ./packages/loki.nix {
inherit imageTag;
version = shortGitRevsion;
pkgs = prev;
};
logcli = loki.overrideAttrs (oldAttrs: {
pname = "logcli";
buildPhase = ''
export GOCACHE=$TMPDIR/go-cache
make clean logcli
'';
installPhase = ''
mkdir -p $out/bin
install -m755 cmd/logcli/logcli $out/bin/logcli
'';
});
loki-canary = loki.overrideAttrs (oldAttrs: {
pname = "loki-canary";
buildPhase = ''
export GOCACHE=$TMPDIR/go-cache
make clean loki-canary
'';
installPhase = ''
mkdir -p $out/bin
install -m755 cmd/loki-canary/loki-canary $out/bin/loki-canary
'';
});
promtail = loki.overrideAttrs (oldAttrs: {
pname = "promtail";
buildInputs =
let
inherit (oldAttrs) buildInputs;
in
if prev.stdenv.hostPlatform.isLinux then
buildInputs ++ (with prev; [ systemd ])
else buildInputs;
buildPhase = ''
export GOCACHE=$TMPDIR/go-cache
make clean promtail
'';
installPhase = ''
mkdir -p $out/bin
install -m755 clients/cmd/promtail/promtail $out/bin/promtail
'';
});
};
}