nixpkgs/pkgs/servers/monitoring/longview/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

69 lines
1.9 KiB
Nix

{lib, stdenv, fetchFromGitHub, perl, perlPackages, makeWrapper, glibc }:
stdenv.mkDerivation rec {
version = "1.1.5";
pname = "longview";
src = fetchFromGitHub {
owner = "linode";
repo = "longview";
rev = "v${version}";
sha256 = "1i9lli8iw8sb1bd633i82fzhx5gz85ma9d1hra41pkv2p3h823pa";
};
patches = [
# log to systemd journal
./log-stdout.patch
];
# Read all configuration from /run/longview
postPatch = ''
substituteInPlace Linode/Longview/Util.pm \
--replace /var/run/longview.pid /run/longview/longview.pid \
--replace /etc/linode /run/longview
substituteInPlace Linode/Longview.pl \
--replace /etc/linode /run/longview
'';
buildInputs = [ perl makeWrapper glibc ]
++ (with perlPackages; [
LWP
LWPProtocolHttps
MozillaCA
CryptSSLeay
IOSocketInet6
LinuxDistribution
JSONPP
JSON
LogLogLite
TryTiny
DBI
DBDmysql
]);
dontBuild = true;
installPhase = ''
mkdir -p $out/bin $out/usr
mv Linode $out
ln -s ../Linode/Longview.pl $out/bin/longview
for h in syscall.h sys/syscall.h asm/unistd.h asm/unistd_32.h asm/unistd_64.h bits/wordsize.h bits/syscall.h; do
${perl}/bin/h2ph -d $out ${glibc.dev}/include/$h
mkdir -p $out/usr/include/$(dirname $h)
mv $out${glibc.dev}/include/''${h%.h}.ph $out/usr/include/$(dirname $h)
done
wrapProgram $out/Linode/Longview.pl --prefix PATH : ${perl}/bin:$out/bin \
--suffix PERL5LIB : $out/Linode --suffix PERL5LIB : $PERL5LIB \
--suffix PERL5LIB : $out --suffix INC : $out
'';
meta = with lib; {
homepage = "https://www.linode.com/longview";
description = "Collects all of your system-level metrics and sends them to Linode";
license = licenses.gpl2Plus;
maintainers = [ maintainers.rvl ];
inherit version;
platforms = [ "x86_64-linux" "i686-linux" ];
};
}