nixpkgs/pkgs/servers/nfd/default.nix
Adam Joseph 42815b4a0c treewide: systemdSupport: use lib.meta.availableOn
Many packages have some kind of flag indicating whether or not to build with
systemd support.  Most of these default to `stdenv.isLinux`, but systemd does
not build on (and is marked `broken` for) `isStatic`.  Only a few packages have
the needed `&& !isStatic` in the default value for their parameter.

This commit moves the logic for the default value of these flags into
`systemd.meta.{platforms,badPlatforms}` and evaluates those conditions using
`lib.meta.availableOn`.

This provides three benefits:

1. The default values are set correctly (i.e. including `&& isStatic`)

2. The default values are set consistently

3. The way is paved for any future non-Linux systemd platforms (FreeBSD is
   reported to have experimental systemd support)
2023-01-22 00:27:19 -08:00

56 lines
1.3 KiB
Nix

{ lib
, stdenv
, boost175
, fetchFromGitHub
, libpcap
, ndn-cxx
, openssl
, pkg-config
, sphinx
, systemd
, wafHook
, websocketpp
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, withWebSocket ? true
}:
stdenv.mkDerivation rec {
pname = "nfd";
version = "0.7.1";
src = fetchFromGitHub {
owner = "named-data";
repo = lib.toUpper pname;
rev = "NFD-${version}";
sha256 = "sha256-8Zm8oxbpw9qD31NuofDdgPYnTWIz5E04NhkZhiRkK9E=";
fetchSubmodules = true;
};
nativeBuildInputs = [ pkg-config sphinx wafHook ];
buildInputs = [ libpcap ndn-cxx openssl websocketpp ] ++ lib.optional withSystemd systemd;
wafConfigureFlags = [
"--boost-includes=${boost175.dev}/include"
"--boost-libs=${boost175.out}/lib"
"--with-tests"
] ++ lib.optional (!withWebSocket) "--without-websocket";
doCheck = true;
checkPhase = ''
runHook preCheck
build/unit-tests-core
# build/unit-tests-daemon # 3 tests fail
build/unit-tests-rib
build/unit-tests-tools
runHook postCheck
'';
meta = with lib; {
homepage = "https://named-data.net/";
description = "Named Data Networking (NDN) Forwarding Daemon";
license = licenses.gpl3Plus;
platforms = platforms.unix;
maintainers = [ lib.maintainers.bertof ];
};
}