biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / applications / misc / elogind / default.nix
blob3d23056e69d117a5a443d43bc8e73b93d9e0cda9
1 { stdenv
2 , lib
3 , fetchFromGitHub
4 , fetchurl
5 , fetchpatch
6 , meson
7 , ninja
8 , m4
9 , gperf
10 , getent
11 , acl
12 , audit
13 , dbus
14 , libcap
15 , libselinux
16 , pam
17 , gettext
18 , pkg-config
19 , udev
20 , eudev
21 , util-linux
22 , libxslt
23 , python3Packages
24 , docbook5
25 , docbook_xsl
26 , docbook_xsl_ns
27 , docbook_xml_dtd_42
28 , docbook_xml_dtd_45
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 {
37   pname = "elogind";
38   version = "255.5";
40   src = fetchFromGitHub {
41     owner = "elogind";
42     repo = pname;
43     rev = "v${version}";
44     hash = "sha256-4KZr/NiiGVwzdDROhiX3GEQTUyIGva6ezb+xC2U3bkg=";
45   };
47   nativeBuildInputs = [
48     meson
49     ninja
50     m4
51     pkg-config
52     gperf
53     getent
54     libcap
55     gettext
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
61   ];
63   buildInputs = [ acl audit dbus libcap libselinux pam util-linux ]
64     ++ (if enableSystemd then [ udev ] else [ eudev ]);
66   postPatch = ''
67     substituteInPlace meson.build --replace-fail "install_emptydir(elogindstatedir)" ""
68   '';
70   patches = [
71     (fetchurl {
72       url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/strerror_r.patch";
73       hash = "sha256-amqXP12mLtrkWuAURb3/aoQeeTSRYlYqL2q2zrKbhxk=";
74     })
75     (fetchurl {
76       url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/strerror_r_1.patch";
77       hash = "sha256-tVUlmPValUPApqRX+Cqkzn7bkIILYSuCouvgRsdl9XE=";
78     })
79     (fetchpatch {
80       url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/xxx-musl-fixes.patch";
81       includes = [
82         "src/basic/missing_prctl.h"
83         "src/libelogind/sd-journal/journal-file.h"
84       ];
85       hash = "sha256-JYPB9AKbQpVgid5BhwBTvcebE5rxDFRMYhKRNS8KPTc=";
86     })
87     (fetchurl {
88       url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/gshadow.patch";
89       hash = "sha256-YBy1OeWD1EluLTeUvqUvZKyrZyoUbGg1mxwqG5+VNO0=";
90     })
91     (fetchurl {
92       name = "FTW.patch";
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=";
95     })
96     (fetchurl {
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=";
100     })
101     (fetchpatch {
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";
104       stripLen = 3;
105       extraPrefix = [ "src/libelogind/" ];
106       hash = "sha256-rtSnCEK+frhnlwl/UW3YHxB8MUCAq48jEzQRURpxdXk=";
107     })
108     (fetchurl {
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=";
112     })
113     ./Add-missing-musl_missing.h-includes-for-basename.patch
114     ./Remove-outdated-musl-hack-in-rlimit_nofile_safe.patch
115   ];
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.
121   preConfigure = ''
122     for dir in tools src/test; do
123       patchShebangs $dir
124     done
126     patchShebangs src/basic/generate-*.{sh,py}
127   '';
129   mesonFlags = [
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)
135   ];
137   meta = with lib; {
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 ];
143   };