php.extensions.systemd: init at 0.1.2-unstable-2018-06-11

This commit is contained in:
Lukas Nagel 2025-06-14 17:48:34 +02:00
parent e4766bb0c9
commit 7c701efdc2
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,54 @@
{
buildPecl,
fetchFromGitHub,
fetchpatch,
lib,
php,
runCommand,
systemd,
}:
buildPecl {
pname = "systemd";
version = "0.1.2-unstable-2018-06-11";
src = fetchFromGitHub {
owner = "systemd";
repo = "php-systemd";
rev = "22cf92a6b54ef4c5c13c301fc97d7a7b1615ee62";
hash = "sha256-UhpE9QXChqKLBqutpQ2Y6neo/ULlJGNojf9DCYJfQMU=";
};
patches = [
# Add missing arginfo to suppress the warning
# https://github.com/systemd/php-systemd/issues/9
(fetchpatch {
url = "https://github.com/systemd/php-systemd/commit/0f25ec9aab7747e85445a48213020ea6adda3658.diff";
hash = "sha256-SNRYDRxaeP9LlHxfZOak0OSqZ3AJA+I9Ln0k+yO0DvE=";
})
# Define SD_JOURNAL_SUPPRESS_LOCATION so that the php source code location is used, instead of the C one
# https://github.com/systemd/php-systemd/issues/2
(fetchpatch {
url = "https://github.com/systemd/php-systemd/commit/23575461b8cc55fa9c4132a58393b6438c2aff5c.diff";
hash = "sha256-KBGWdNE7spXpqbeS4c2D5IU3Dz8zGxx4r22FDOA0KzM=";
})
];
buildInputs = [ systemd.dev ];
configureFlags = [ "--with-systemd=${systemd.dev}" ];
# php will exit with a non-zero exit code, if the extension is not loaded
passthru.tests.smokeTest = runCommand "php-systemd-smoke-test" { } ''
echo "<?php sd_journal_send('MESSAGE=Hello world.'); ?>" |
${lib.getExe (php.withExtensions ({ all, ... }: [ all.systemd ]))}
echo ok > $out
'';
meta = {
description = "PHP extension allowing native interaction with systemd and its journal";
homepage = "https://github.com/systemd/php-systemd";
license = lib.licenses.mit;
teams = [ lib.teams.php ];
};
}

View File

@ -389,6 +389,8 @@ lib.makeScope pkgs.newScope (
swoole = callPackage ../development/php-packages/swoole { };
systemd = callPackage ../development/php-packages/systemd { };
tideways = callPackage ../development/php-packages/tideways { };
uuid = callPackage ../development/php-packages/uuid { };