30 # Defaulting to false because usually the rationale for using elogind is to
31 # use it in situation where a systemd dependency does not work (especially
32 # when building with musl, which elogind explicitly supports).
33 , enableSystemd ? false
36 stdenv.mkDerivation rec {
40 src = fetchFromGitHub {
44 hash = "sha256-4KZr/NiiGVwzdDROhiX3GEQTUyIGva6ezb+xC2U3bkg=";
56 libxslt.bin # xsltproc
57 docbook5 docbook_xsl docbook_xsl_ns docbook_xml_dtd_42 docbook_xml_dtd_45 # needed for docbook without Internet
59 python3Packages.python
60 python3Packages.jinja2
63 buildInputs = [ acl audit dbus libcap libselinux pam util-linux ]
64 ++ (if enableSystemd then [ udev ] else [ eudev ]);
67 substituteInPlace meson.build --replace-fail "install_emptydir(elogindstatedir)" ""
72 url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/strerror_r.patch";
73 hash = "sha256-amqXP12mLtrkWuAURb3/aoQeeTSRYlYqL2q2zrKbhxk=";
76 url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/strerror_r_1.patch";
77 hash = "sha256-tVUlmPValUPApqRX+Cqkzn7bkIILYSuCouvgRsdl9XE=";
80 url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/xxx-musl-fixes.patch";
82 "src/basic/missing_prctl.h"
83 "src/libelogind/sd-journal/journal-file.h"
85 hash = "sha256-JYPB9AKbQpVgid5BhwBTvcebE5rxDFRMYhKRNS8KPTc=";
88 url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/gshadow.patch";
89 hash = "sha256-YBy1OeWD1EluLTeUvqUvZKyrZyoUbGg1mxwqG5+VNO0=";
93 url = "https://git.openembedded.org/openembedded-core/plain/meta/recipes-core/systemd/systemd/0005-add-missing-FTW_-macros-for-musl.patch?id=6bc5e3f3cd882c81c972dbd27aacc1ce00e5e59a";
94 hash = "sha256-SGvP0GT43vfyHxrmvl4AbsWQz8CPmNGyH001s3lTxng=";
97 name = "malloc_info.patch";
98 url = "https://git.openembedded.org/openembedded-core/plain/meta/recipes-core/systemd/systemd/0016-pass-correct-parameters-to-getdents64.patch?id=6bc5e3f3cd882c81c972dbd27aacc1ce00e5e59a";
99 hash = "sha256-8aOw+BTtl5Qta8aqLmliKSHEirTjp1xLM195EmBdEDI=";
102 name = "malloc_trim.patch";
103 url = "https://git.openembedded.org/openembedded-core/plain/meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch?id=6bc5e3f3cd882c81c972dbd27aacc1ce00e5e59a";
105 extraPrefix = [ "src/libelogind/" ];
106 hash = "sha256-rtSnCEK+frhnlwl/UW3YHxB8MUCAq48jEzQRURpxdXk=";
109 name = "malloc_info.patch";
110 url = "https://git.openembedded.org/openembedded-core/plain/meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch?id=6bc5e3f3cd882c81c972dbd27aacc1ce00e5e59a";
111 hash = "sha256-ZyOCmM5LcwJ7mHiZr0lQjV4G+XMxjhsUm7g7L3OzDDM=";
113 ./Add-missing-musl_missing.h-includes-for-basename.patch
114 ./Remove-outdated-musl-hack-in-rlimit_nofile_safe.patch
117 # Inspired by the systemd `preConfigure`.
118 # Conceptually we should patch all files required during the build, but not scripts
119 # supposed to run at run-time of the software (important for cross-compilation).
120 # This package seems to have mostly scripts that run at build time.
122 for dir in tools src/test; do
126 patchShebangs src/basic/generate-*.{sh,py}
130 (lib.mesonOption "dbuspolicydir" "${placeholder "out"}/share/dbus-1/system.d")
131 (lib.mesonOption "dbussystemservicedir" "${placeholder "out"}/share/dbus-1/system-services")
132 (lib.mesonOption "sysconfdir" "${placeholder "out"}/etc")
133 (lib.mesonBool "utmp" (!stdenv.hostPlatform.isMusl))
134 (lib.mesonEnable "xenctrl" false)
138 homepage = "https://github.com/elogind/elogind";
139 description = ''The systemd project's "logind", extracted to a standalone package'';
140 platforms = platforms.linux; # probably more
141 license = licenses.lgpl21Plus;
142 maintainers = with maintainers; [ nh2 ];