Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions pkgs/applications/misc/elogind/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{ stdenv
, lib
, fetchFromGitHub
, meson
, ninja
, m4
, gperf
, getent
, libcap
, gettext
, pkgconfig
, udev
, eudev
, libxslt
, python3
, docbook5
, docbook_xsl
, docbook_xsl_ns
, docbook_xml_dtd_42
, docbook_xml_dtd_45

# Defaulting to false because usually the rationale for using elogind is to
# use it in situation where a systemd dependency does not work (especially
# when building with musl, which elogind explicitly supports).
, enableSystemd ? false
}:

with stdenv.lib;

stdenv.mkDerivation rec {
pname = "elogind";
version = "239.5";

src = fetchFromGitHub {
owner = "elogind";
repo = pname;
rev = "v${version}";
sha256 = "1gdiy4vbx4gs2hnb79x14zi530mlq26glxpzp3c95w8l058wj4ba";
};

nativeBuildInputs = [
meson
ninja
m4
pkgconfig
gperf
getent
libcap
gettext
libxslt.bin # xsltproc
docbook5 docbook_xsl docbook_xsl_ns docbook_xml_dtd_42 docbook_xml_dtd_45 # needed for docbook without Internet
(python3.withPackages (p: with p; [ lxml ])) # fixes: man/meson.build:111:0: ERROR: Could not execute command "/build/source/tools/xml_helper.py".
];

buildInputs =
if enableSystemd then [ udev ] else [ eudev ];

# Inspired by the systemd `preConfigure`.
# Conceptually we should patch all files required during the build, but not scripts
# supposed to run at run-time of the software (important for cross-compilation).
# This package seems to have mostly scripts that run at build time.
preConfigure = ''
for dir in tools src/test; do
patchShebangs $dir
done

patchShebangs src/basic/generate-*.{sh,py}
'';

mesonFlags = [
"-Drootprefix=${placeholder "out"}"
"-Dsysconfdir=${placeholder "out"}/etc"
];

meta = {
homepage = https://github.com/elogind/elogind;
description = ''The systemd project's "logind", extracted to a standalone package'';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just escape " with \ here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that better?

I thought one purpose (as per nix manual) of '' quotes is to not have to do so much escaping.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that in the nix manual? I just think it's weird to use when it isn't multi-line, perhaps it's just my style preference.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to use English quotes and apostrophes (u+201c, u+201d, u+2019) in human readable texts, which bypasses the need for escaping altogether.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that in the nix manual?

Yes here:

Indented strings are primarily useful in that they allow multi-line string literals to follow the indentation of the enclosing Nix expression, and that less escaping is typically necessary for strings representing languages such as shell scripts and configuration files because '' is much less common than ".

For what it's worth, I just copied the description verbatim from the Github repo description on https://github.com/elogind/elogind and using '' made it possible to do that without having to mess with the description.

platforms = platforms.linux; # probably more
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ nh2 ];
};
}
19 changes: 16 additions & 3 deletions pkgs/development/libraries/polkit/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{ stdenv, fetchurl, pkgconfig, glib, expat, pam, perl, fetchpatch
, intltool, spidermonkey_60 , gobject-introspection, libxslt, docbook_xsl, dbus
, docbook_xml_dtd_412, gtk-doc, coreutils
, useSystemd ? stdenv.isLinux, systemd
, useSystemd ? (stdenv.isLinux && !stdenv.hostPlatform.isMusl), systemd, elogind
, withGnome ? true
, doCheck ? stdenv.isLinux
# A few tests currently fail on musl (polkitunixusertest, polkitunixgrouptest, polkitidentitytest segfault).
# Not yet investigated; it may be due to the "Make netgroup support optional"
# patch not updating the tests correctly yet, or doing something wrong,
# or being unrelated to that.
, doCheck ? (stdenv.isLinux && !stdenv.hostPlatform.isMusl)
}:

let
Expand All @@ -28,6 +32,15 @@ stdenv.mkDerivation rec {
url = "https://gitlab.freedesktop.org/polkit/polkit/merge_requests/11.patch";
sha256 = "17lv7xj5ksa27iv4zpm4zwd4iy8zbwjj4ximslfq3sasiz9kxhlp";
})
] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
# Make netgroup support optional (musl does not have it)
# Upstream MR: https://gitlab.freedesktop.org/polkit/polkit/merge_requests/10
# We use the version of the patch that Alpine uses successfully.
(fetchpatch {
name = "make-innetgr-optional.patch";
url = "https://git.alpinelinux.org/aports/plain/main/polkit/make-innetgr-optional.patch?id=391e7de6ced1a96c2dac812e0b12f1d7e0ea705e";
sha256 = "1p9qqqhnrfyjvvd50qh6vpl256kyfblm1qnhz5pm09klrl1bh1n4";
})
];

postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
Expand All @@ -41,7 +54,7 @@ stdenv.mkDerivation rec {
++ [ libxslt docbook_xsl docbook_xml_dtd_412 ]; # man pages
buildInputs =
[ expat pam spidermonkey_60 ]
++ stdenv.lib.optional useSystemd systemd
++ (if useSystemd then [systemd] else [elogind])
++ stdenv.lib.optional withGnome gobject-introspection;

propagatedBuildInputs = [
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,8 @@ in

elm-github-install = callPackage ../tools/package-management/elm-github-install { };

elogind = callPackage ../applications/misc/elogind { };

enca = callPackage ../tools/text/enca { };

ent = callPackage ../tools/misc/ent { };
Expand Down