nixpkgs/pkgs/by-name/un/unixbench/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

118 lines
2.2 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
makeWrapper,
pandoc,
installShellFiles,
perl,
xorg,
libGLX,
coreutils,
unixtools,
runtimeShell,
targetPackages,
gnugrep,
gawk,
withGL ? true,
withX11perf ? true,
}:
stdenv.mkDerivation rec {
pname = "unixbench";
version = "unstable-2023-02-27";
src = fetchFromGitHub {
owner = "kdlucas";
repo = "byte-unixbench";
rev = "a07fcc03264915c624f0e4818993c5b4df3fa703";
hash = "sha256-gmRWAqE9/HBb0S9rK0DXoaCoiGbtat0gmdeozhbv0NI=";
};
patches = [
./common.patch
];
patchFlags = [ "-p2" ];
sourceRoot = "${src.name}/UnixBench";
postPatch = ''
substituteInPlace Makefile \
--replace "-Wa,-q" ""
'';
nativeBuildInputs = [
makeWrapper
pandoc
installShellFiles
];
buildInputs =
[ perl ]
++ lib.optionals withGL [
xorg.libX11
xorg.libXext
libGLX
];
runtimeDependencies =
[
coreutils
unixtools.nettools
unixtools.locale
targetPackages.stdenv.cc
gnugrep
gawk
]
++ lib.optionals withX11perf [
xorg.x11perf
];
makeFlags =
[
"CC=${stdenv.cc.targetPrefix}cc"
]
++ lib.optionals withGL [
"GRAPHIC_TESTS=defined"
];
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,libexec,share}
install -D Run $out/bin/ubench
cp -r pgms $out/libexec/
cp -r testdir $out/share/
runHook postInstall
'';
postInstall = ''
substituteInPlace USAGE \
--replace 'Run"' 'ubench"' \
--replace './Run' 'ubench' \
--replace 'Run ' 'ubench '
pandoc -f rst -t man USAGE -o ubench.1
installManPage ubench.1
'';
preFixup = ''
substituteInPlace $out/libexec/pgms/multi.sh \
--replace '/bin/sh "$' '${runtimeShell} "$'
substituteInPlace $out/bin/ubench \
--subst-var out
wrapProgram $out/bin/ubench \
--prefix PATH : ${lib.makeBinPath runtimeDependencies}
'';
meta = with lib; {
description = "Basic indicator of the performance of a Unix-like system";
homepage = "https://github.com/kdlucas/byte-unixbench";
license = licenses.gpl2Plus;
mainProgram = "ubench";
maintainers = with maintainers; [ aleksana ];
platforms = platforms.unix;
};
}