nixpkgs/pkgs/by-name/fa/fastnetmon-advanced/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

69 lines
1.9 KiB
Nix

{ lib
, stdenv
, fetchurl
, autoPatchelfHook
, bzip2
, nixosTests
}:
stdenv.mkDerivation rec {
pname = "fastnetmon-advanced";
version = "2.0.367";
src = fetchurl {
url = "https://repo.fastnetmon.com/fastnetmon_ubuntu_jammy/pool/fastnetmon/f/fastnetmon/fastnetmon_${version}_amd64.deb";
hash = "sha256-D/4kkT6ehEmlfRUeP1uLuO/hd9ZrMBJSKF5DKYXOPxs=";
};
nativeBuildInputs = [
autoPatchelfHook
];
buildInputs = [
bzip2
];
unpackPhase = ''
ar xf $src
tar xf data.tar.xz
# unused libraries, which have additional dependencies
rm opt/fastnetmon/libraries/gcc1210/lib/libgccjit.so.0.0.1
'';
installPhase = ''
mkdir -p $out/libexec/fastnetmon
cp -r opt/fastnetmon/app/bin $out/bin
cp -r opt/fastnetmon/libraries $out/libexec/fastnetmon
readlink usr/sbin/gobgpd
readlink usr/bin/gobgp
ln -s $(readlink usr/sbin/gobgpd | sed "s:/opt/fastnetmon:$out/libexec/fastnetmon:") $out/bin/fnm-gobgpd
ln -s $(readlink usr/bin/gobgp | sed "s:/opt/fastnetmon:$out/libexec/fastnetmon:") $out/bin/fnm-gobgp
addAutoPatchelfSearchPath $out/libexec/fastnetmon/libraries
'';
doInstallCheck = true;
installCheckPhase = ''
set +o pipefail
$out/bin/fastnetmon 2>&1 | grep "Can't open log file"
$out/bin/fcli 2>&1 | grep "Please run this tool with root rights"
$out/bin/fnm-gobgp --help 2>&1 | grep "Available Commands"
$out/bin/fnm-gobgpd --help 2>&1 | grep "Application Options"
'';
passthru.tests = { inherit (nixosTests) fastnetmon-advanced; };
meta = with lib; {
description = "High performance DDoS detector / sensor - commercial edition";
homepage = "https://fastnetmon.com";
changelog = "https://github.com/FastNetMon/fastnetmon-advanced-releases/releases/tag/v${version}";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
maintainers = teams.wdz.members;
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
};
}