-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5d62bd
commit 03a0587
Showing
8 changed files
with
162 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
--- | ||
name: "Lint And Build Nix Flake" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
paths: | ||
- "flake.nix" | ||
|
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,91 @@ | ||
{ self }: | ||
{ self, pkgs, lib }: | ||
let | ||
# self.rev is only set on a clean git tree | ||
gitRevision = if (self ? rev) then self.rev else "dirty"; | ||
shortGitRevsion = with 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 lib; | ||
if (self ? rev) then | ||
(strings.concatStrings | ||
(lists.take 8 (strings.stringToCharacters gitRevision))) | ||
else | ||
"dirty"; | ||
|
||
imageTag = | ||
if (self ? rev) then | ||
"${imageTagVersion}" | ||
else | ||
"${imageTagVersion}-WIP"; | ||
|
||
meta = with lib; { | ||
homepage = "https://grafana.com/oss/loki/"; | ||
changelog = "https://github.com/grafana/loki/commit/${shortGitRevsion}"; | ||
maintainers = with maintainers; [ trevorwhitney ]; | ||
|
||
}; | ||
|
||
loki-helm-test = pkgs.callPackage ../production/helm/loki/src/helm-test { | ||
inherit pkgs; | ||
inherit (pkgs) lib buildGoModule dockerTools; | ||
rev = gitRevision; | ||
}; | ||
in | ||
{ | ||
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 | ||
''; | ||
}); | ||
}; | ||
inherit (loki-helm-test) loki-helm-test loki-helm-test-docker; | ||
} // rec { | ||
loki = pkgs.callPackage ./packages/loki.nix { | ||
inherit imageTag pkgs; | ||
version = shortGitRevsion; | ||
}; | ||
|
||
logcli = loki.overrideAttrs (oldAttrs: { | ||
pname = "logcli"; | ||
|
||
subPackages = [ "cmd/logcli" ]; | ||
|
||
meta = with lib; { | ||
description = "LogCLI is a command line tool for interacting with Loki."; | ||
mainProgram = "logcli"; | ||
license = with licenses; [ agpl3Only ]; | ||
} // meta; | ||
}); | ||
|
||
loki-canary = loki.overrideAttrs (oldAttrs: { | ||
pname = "loki-canary"; | ||
|
||
subPackages = [ "cmd/loki-canary" ]; | ||
|
||
meta = with lib; { | ||
description = "Loki Canary is a canary for the Loki project."; | ||
mainProgram = "loki-canary"; | ||
license = with licenses; [ agpl3Only ]; | ||
} // meta; | ||
}); | ||
|
||
promtail = loki.overrideAttrs (oldAttrs: { | ||
pname = "promtail"; | ||
|
||
buildInputs = with pkgs; lib.optionals stdenv.hostPlatform.isLinux [ systemd.dev ]; | ||
|
||
tags = [ "promtail_journal_enabled" ]; | ||
|
||
subPackages = [ "clients/cmd/promtail" ]; | ||
|
||
preFixup = lib.optionalString pkgs.stdenv.hostPlatform.isLinux '' | ||
wrapProgram $out/bin/promtail \ | ||
--prefix LD_LIBRARY_PATH : "${lib.getLib pkgs.systemd}/lib" | ||
''; | ||
|
||
meta = with lib; { | ||
description = "Client for sending logs to Loki"; | ||
mainProgram = "promtail"; | ||
license = with licenses; [ asl20 ]; | ||
} // meta; | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.