3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/servers/monitoring/loki/default.nix

56 lines
1.3 KiB
Nix
Raw Normal View History

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