2024-06-30 08:16:52 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
lib,
|
|
|
|
perl,
|
|
|
|
pkg-config,
|
|
|
|
curl,
|
|
|
|
nix,
|
|
|
|
libsodium,
|
|
|
|
boost,
|
|
|
|
autoreconfHook,
|
|
|
|
autoconf-archive,
|
|
|
|
nlohmann_json,
|
|
|
|
xz,
|
|
|
|
Security,
|
|
|
|
meson,
|
|
|
|
ninja,
|
|
|
|
bzip2,
|
2024-05-02 00:46:19 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
atLeast223 = lib.versionAtLeast nix.version "2.23";
|
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
mkConfigureOption =
|
|
|
|
{
|
|
|
|
mesonOption,
|
|
|
|
autoconfOption,
|
|
|
|
value,
|
|
|
|
}:
|
2024-05-02 00:46:19 +00:00
|
|
|
let
|
2024-06-30 08:16:52 +00:00
|
|
|
setFlagTo =
|
|
|
|
if atLeast223 then lib.mesonOption mesonOption else lib.withFeatureAs true autoconfOption;
|
2024-05-02 00:46:19 +00:00
|
|
|
in
|
|
|
|
setFlagTo value;
|
2024-06-30 08:16:52 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2024-05-02 00:46:19 +00:00
|
|
|
pname = "nix-perl";
|
|
|
|
inherit (nix) version src;
|
|
|
|
|
|
|
|
postUnpack = "sourceRoot=$sourceRoot/perl";
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
boost
|
|
|
|
bzip2
|
|
|
|
curl
|
|
|
|
libsodium
|
|
|
|
nix
|
|
|
|
perl
|
|
|
|
xz
|
|
|
|
] ++ lib.optional (stdenv.isDarwin) Security;
|
|
|
|
|
|
|
|
# Not cross-safe since Nix checks for curl/perl via
|
|
|
|
# NEED_PROG/find_program, but both seem to be needed at runtime
|
|
|
|
# as well.
|
2024-06-30 08:16:52 +00:00
|
|
|
nativeBuildInputs =
|
|
|
|
[
|
|
|
|
pkg-config
|
|
|
|
perl
|
|
|
|
curl
|
|
|
|
]
|
|
|
|
++ (
|
|
|
|
if atLeast223 then
|
|
|
|
[
|
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
]
|
|
|
|
else
|
|
|
|
[
|
|
|
|
autoconf-archive
|
|
|
|
autoreconfHook
|
|
|
|
]
|
|
|
|
);
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
# `perlPackages.Test2Harness` is marked broken for Darwin
|
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
nativeCheckInputs = [ perl.pkgs.Test2Harness ];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
${if atLeast223 then "mesonFlags" else "configureFlags"} = [
|
|
|
|
(mkConfigureOption {
|
|
|
|
mesonOption = "dbi_path";
|
|
|
|
autoconfOption = "dbi";
|
|
|
|
value = "${perl.pkgs.DBI}/${perl.libPrefix}";
|
|
|
|
})
|
|
|
|
(mkConfigureOption {
|
|
|
|
mesonOption = "dbd_sqlite_path";
|
|
|
|
autoconfOption = "dbd-sqlite";
|
|
|
|
value = "${perl.pkgs.DBDSQLite}/${perl.libPrefix}";
|
|
|
|
})
|
2024-06-30 08:16:52 +00:00
|
|
|
] ++ lib.optionals atLeast223 [ (lib.mesonEnable "tests" finalAttrs.doCheck) ];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
preConfigure = "export NIX_STATE_DIR=$TMPDIR";
|
|
|
|
})
|