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 {
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "2.9.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "grafana-loki";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "grafana";
|
|
|
|
repo = "loki";
|
2023-04-12 12:48:02 +00:00
|
|
|
rev = "v${version}";
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-9EUlznnZczgHXUy784830FvUS6OwaFf7FmUJGeWeXP0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
vendorHash = null;
|
2020-11-03 02:18:15 +00:00
|
|
|
|
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
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
tags = ["promtail_journal_enabled"];
|
|
|
|
|
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
|
|
|
|
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/";
|
2023-05-24 13:37:59 +00:00
|
|
|
changelog = "https://github.com/grafana/loki/releases/tag/v${version}";
|
2024-01-02 11:29:13 +00:00
|
|
|
maintainers = with maintainers; [ willibutz globin mmahut emilylange ] ++ teams.helsinki-systems.members;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|