2021-04-08 16:26:57 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, nixosTests
|
|
|
|
, systemd
|
2020-11-12 09:05:59 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-03 02:18:15 +00:00
|
|
|
buildGoModule rec {
|
2022-07-14 12:49:19 +00:00
|
|
|
version = "2.6.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "grafana-loki";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
rev = "v${version}";
|
|
|
|
owner = "grafana";
|
|
|
|
repo = "loki";
|
2022-07-14 12:49:19 +00:00
|
|
|
sha256 = "sha256-LPunSNKF0HBlmYOn0AIT0zLSVmLaizDnDchJhMjexfM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-11-03 02:18:15 +00:00
|
|
|
vendorSha256 = null;
|
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
subPackages = [
|
|
|
|
# TODO split every executable into its own package
|
|
|
|
"cmd/loki"
|
|
|
|
"cmd/loki-canary"
|
2021-08-08 23:34:03 +00:00
|
|
|
"clients/cmd/promtail"
|
2021-03-19 17:17:44 +00:00
|
|
|
"cmd/logcli"
|
|
|
|
];
|
2020-11-03 02:18:15 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2021-01-15 22:18:51 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isLinux [ systemd.dev ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
preFixup = lib.optionalString stdenv.isLinux ''
|
2020-05-15 21:57:56 +00:00
|
|
|
wrapProgram $out/bin/promtail \
|
2020-09-25 04:45:31 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : "${lib.getLib systemd}/lib"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-11-12 09:05:59 +00:00
|
|
|
passthru.tests = { inherit (nixosTests) loki; };
|
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
ldflags = let t = "github.com/grafana/loki/pkg/util/build"; in [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X ${t}.Version=${version}"
|
|
|
|
"-X ${t}.BuildUser=nix@nixpkgs"
|
|
|
|
"-X ${t}.BuildDate=unknown"
|
|
|
|
"-X ${t}.Branch=unknown"
|
|
|
|
"-X ${t}.Revision=unknown"
|
|
|
|
];
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2020-11-03 02:18:15 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Like Prometheus, but for logs";
|
2021-08-08 23:34:03 +00:00
|
|
|
license = with licenses; [ agpl3Only asl20 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://grafana.com/oss/loki/";
|
|
|
|
maintainers = with maintainers; [ willibutz globin mmahut ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|