nixpkgs/pkgs/tools/system/awstats/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

63 lines
1.4 KiB
Nix

{ lib, stdenv, fetchurl, perlPackages, jdk }:
perlPackages.buildPerlPackage rec {
pname = "awstats";
version = "7.7";
src = fetchurl {
url = "mirror://sourceforge/awstats/${pname}-${version}.tar.gz";
sha256 = "0z3p77jnpjilajs9yv87r8xla2x1gjqlvrhpbgbh5ih73386v3j2";
};
postPatch = ''
substituteInPlace wwwroot/cgi-bin/awstats.pl \
--replace /usr/share/awstats/ "$out/wwwroot/cgi-bin/"
'';
outputs = [ "bin" "out" "doc" ]; # bin just links the user-run executable
propagatedBuildOutputs = [ ]; # otherwise out propagates bin -> cycle
buildInputs = with perlPackages; [ ]; # plugins will need some
preConfigure = ''
touch Makefile.PL
patchShebangs .
'';
# build our own JAR
preBuild = ''
(
cd wwwroot/classes/src
rm ../*.jar
PATH="${jdk}/bin" "$(type -P perl)" Makefile.pl
test -f ../*.jar
)
'';
doCheck = false;
installPhase = ''
mkdir "$out"
mv wwwroot "$out/wwwroot"
rm -r "$out/wwwroot/classes/src/"
mkdir -p "$out/share/awstats"
mv tools "$out/share/awstats/tools"
mkdir -p "$bin/bin"
ln -s "$out/wwwroot/cgi-bin/awstats.pl" "$bin/bin/awstats"
mkdir -p "$doc/share/doc"
mv README.md docs/
mv docs "$doc/share/doc/awstats"
'';
meta = with lib; {
description = "Real-time logfile analyzer to get advanced statistics";
homepage = "http://awstats.org";
license = licenses.gpl3Plus;
platforms = platforms.unix;
};
}