2021-04-06 01:31:10 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, nixosTests
|
|
|
|
, systemd
|
2020-11-10 09:46:30 +00:00
|
|
|
}:
|
2019-03-01 07:18:57 +00:00
|
|
|
|
2020-10-29 00:13:01 +00:00
|
|
|
buildGoModule rec {
|
2023-09-15 11:08:43 +00:00
|
|
|
version = "2.9.1";
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "grafana-loki";
|
2019-03-01 07:18:57 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "grafana";
|
|
|
|
repo = "loki";
|
2023-04-08 22:16:26 +00:00
|
|
|
rev = "v${version}";
|
2023-09-15 11:08:43 +00:00
|
|
|
hash = "sha256-hfX1srlAd8huLViHlEyk3mcfMhY/LmeryQtAhB7rafw=";
|
2019-03-01 07:18:57 +00:00
|
|
|
};
|
|
|
|
|
2023-04-07 11:02:42 +00:00
|
|
|
vendorHash = null;
|
2020-10-29 00:13:01 +00:00
|
|
|
|
2021-03-15 18:10:46 +00:00
|
|
|
subPackages = [
|
|
|
|
# TODO split every executable into its own package
|
|
|
|
"cmd/loki"
|
|
|
|
"cmd/loki-canary"
|
2021-08-08 03:31:09 +00:00
|
|
|
"clients/cmd/promtail"
|
2021-03-15 18:10:46 +00:00
|
|
|
"cmd/logcli"
|
|
|
|
];
|
2020-10-29 00:13:01 +00:00
|
|
|
|
2023-04-13 09:47:08 +00:00
|
|
|
tags = ["promtail_journal_enabled"];
|
|
|
|
|
2019-08-02 22:19:14 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2021-01-15 07:07:56 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isLinux [ systemd.dev ];
|
2019-08-02 22:19:14 +00:00
|
|
|
|
2021-01-15 07:07:56 +00:00
|
|
|
preFixup = lib.optionalString stdenv.isLinux ''
|
2020-04-28 01:50:57 +00:00
|
|
|
wrapProgram $out/bin/promtail \
|
2020-08-12 18:19:12 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : "${lib.getLib systemd}/lib"
|
2019-08-02 22:19:14 +00:00
|
|
|
'';
|
|
|
|
|
2020-11-10 09:46:30 +00:00
|
|
|
passthru.tests = { inherit (nixosTests) loki; };
|
|
|
|
|
2021-08-08 03:31:09 +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-02 23:12:37 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-11-21 12:18:43 +00:00
|
|
|
description = "Like Prometheus, but for logs";
|
2021-08-08 03:31:09 +00:00
|
|
|
license = with licenses; [ agpl3Only asl20 ];
|
2019-12-15 03:22:22 +00:00
|
|
|
homepage = "https://grafana.com/oss/loki/";
|
2023-05-03 12:49:05 +00:00
|
|
|
changelog = "https://github.com/grafana/loki/releases/tag/v${version}";
|
2023-09-15 12:32:47 +00:00
|
|
|
maintainers = with maintainers; [ willibutz globin mmahut emilylange ajs124 ];
|
2019-03-01 07:18:57 +00:00
|
|
|
};
|
|
|
|
}
|