2018-07-06 13:41:41 -07:00
|
|
|
|
{ stdenv, fetchurl, fetchpatch, autoreconfHook, pkgconfig, glib, expat, pam, perl
|
|
|
|
|
, intltool, spidermonkey_52 , gobjectIntrospection, libxslt, docbook_xsl, dbus
|
|
|
|
|
, docbook_xml_dtd_412, gtk-doc, coreutils
|
2017-05-25 09:05:46 -07:00
|
|
|
|
, useSystemd ? stdenv.isLinux, systemd
|
2018-07-06 13:41:41 -07:00
|
|
|
|
, doCheck ? stdenv.isLinux
|
2017-05-25 09:05:46 -07:00
|
|
|
|
}:
|
2009-08-13 00:55:11 -07:00
|
|
|
|
|
2010-05-15 02:55:31 -07:00
|
|
|
|
let
|
2011-07-07 11:16:03 -07:00
|
|
|
|
|
2018-07-06 13:41:41 -07:00
|
|
|
|
system = "/run/current-system/sw";
|
2017-01-29 02:11:01 -08:00
|
|
|
|
setuid = "/run/wrappers/bin"; #TODO: from <nixos> config.security.wrapperDir;
|
2012-08-21 05:34:59 -07:00
|
|
|
|
|
2010-05-15 02:55:31 -07:00
|
|
|
|
in
|
|
|
|
|
|
2009-08-13 00:55:11 -07:00
|
|
|
|
stdenv.mkDerivation rec {
|
2018-07-06 13:41:41 -07:00
|
|
|
|
name = "polkit-0.114";
|
2010-05-15 02:55:31 -07:00
|
|
|
|
|
2009-08-13 00:55:11 -07:00
|
|
|
|
src = fetchurl {
|
2018-06-28 11:43:35 -07:00
|
|
|
|
url = "https://www.freedesktop.org/software/polkit/releases/${name}.tar.gz";
|
2018-07-06 13:41:41 -07:00
|
|
|
|
sha256 = "1rpdx1vymkn5d8g2vrb7c8h4v60mq5smjjg29mwzsn6pcxrh1x5x";
|
2009-08-13 00:55:11 -07:00
|
|
|
|
};
|
2010-05-15 02:55:31 -07:00
|
|
|
|
|
2017-05-25 09:05:46 -07:00
|
|
|
|
patches = [
|
2018-07-06 13:41:41 -07:00
|
|
|
|
# to remove on 0.115 release
|
2017-05-25 09:05:46 -07:00
|
|
|
|
(fetchpatch {
|
2018-07-06 13:41:41 -07:00
|
|
|
|
name = "format-security.patch";
|
|
|
|
|
url = "https://cgit.freedesktop.org/polkit/patch/?id=373705b35e7f6c7dc83de5e0a3ce11ecd15d0409";
|
|
|
|
|
sha256 = "03fb5039d62cljxi84ir4420p4m1455q022dxamql1mvq3n38mwg";
|
2018-06-15 19:57:44 -07:00
|
|
|
|
})
|
|
|
|
|
];
|
2018-01-14 13:14:28 -08:00
|
|
|
|
|
2018-06-15 19:57:44 -07:00
|
|
|
|
postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
|
sed -i -e "s/-Wl,--as-needed//" configure.ac
|
|
|
|
|
'';
|
2017-05-25 09:05:46 -07:00
|
|
|
|
|
2016-08-28 17:30:01 -07:00
|
|
|
|
outputs = [ "bin" "dev" "out" ]; # small man pages in $bin
|
2015-10-13 21:03:25 -07:00
|
|
|
|
|
2017-05-25 09:05:46 -07:00
|
|
|
|
nativeBuildInputs =
|
2018-07-06 13:41:41 -07:00
|
|
|
|
[ gtk-doc pkgconfig autoreconfHook intltool gobjectIntrospection perl ]
|
2017-05-25 09:05:46 -07:00
|
|
|
|
++ [ libxslt docbook_xsl docbook_xml_dtd_412 ]; # man pages
|
2011-07-07 11:16:03 -07:00
|
|
|
|
buildInputs =
|
2018-07-06 13:41:41 -07:00
|
|
|
|
[ glib expat pam spidermonkey_52 gobjectIntrospection ]
|
2012-08-21 05:34:59 -07:00
|
|
|
|
++ stdenv.lib.optional useSystemd systemd;
|
2009-08-13 00:55:11 -07:00
|
|
|
|
|
2018-07-06 13:41:41 -07:00
|
|
|
|
NIX_CFLAGS_COMPILE = " -Wno-deprecated-declarations "; # for polkit 0.114 and glib 2.56
|
2009-08-16 14:47:51 -07:00
|
|
|
|
|
2015-01-08 01:26:49 -08:00
|
|
|
|
preConfigure = ''
|
2018-07-06 13:41:41 -07:00
|
|
|
|
chmod +x test/mocklibc/bin/mocklibc{,-test}.in
|
2015-01-08 01:26:49 -08:00
|
|
|
|
patchShebangs .
|
2018-07-06 13:41:41 -07:00
|
|
|
|
|
2013-11-09 07:29:18 -08:00
|
|
|
|
# ‘libpolkit-agent-1.so’ should call the setuid wrapper on
|
|
|
|
|
# NixOS. Hard-coding the path is kinda ugly. Maybe we can just
|
|
|
|
|
# call through $PATH, but that might have security implications.
|
|
|
|
|
substituteInPlace src/polkitagent/polkitagentsession.c \
|
|
|
|
|
--replace 'PACKAGE_PREFIX "/lib/polkit-1/' '"${setuid}/'
|
2018-07-06 13:41:41 -07:00
|
|
|
|
substituteInPlace test/data/etc/polkit-1/rules.d/10-testing.rules \
|
|
|
|
|
--replace /bin/true ${coreutils}/bin/true \
|
|
|
|
|
--replace /bin/false ${coreutils}/bin/false
|
|
|
|
|
|
|
|
|
|
'' + stdenv.lib.optionalString useSystemd /* bogus chroot detection */ ''
|
|
|
|
|
sed '/libsystemd autoconfigured/s/.*/:/' -i configure
|
2013-11-09 07:29:18 -08:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
configureFlags = [
|
2018-07-06 13:41:41 -07:00
|
|
|
|
"--datadir=${system}/share"
|
|
|
|
|
"--sysconfdir=/etc"
|
2013-11-09 07:29:18 -08:00
|
|
|
|
"--with-systemdsystemunitdir=$(out)/etc/systemd/system"
|
|
|
|
|
"--with-polkitd-user=polkituser" #TODO? <nixos> config.ids.uids.polkituser
|
|
|
|
|
"--with-os-type=NixOS" # not recognized but prevents impurities on non-NixOS
|
2014-01-25 15:15:51 -08:00
|
|
|
|
"--enable-introspection"
|
2018-06-15 19:57:44 -07:00
|
|
|
|
] ++ stdenv.lib.optional (!doCheck) "--disable-test";
|
2011-08-22 04:45:51 -07:00
|
|
|
|
|
2014-01-25 15:15:51 -08:00
|
|
|
|
makeFlags = "INTROSPECTION_GIRDIR=$(out)/share/gir-1.0 INTROSPECTION_TYPELIBDIR=$(out)/lib/girepository-1.0";
|
2012-08-21 05:34:59 -07:00
|
|
|
|
|
2013-11-14 03:55:54 -08:00
|
|
|
|
# The following is required on grsecurity/PaX due to spidermonkey's JIT
|
2018-06-15 19:57:44 -07:00
|
|
|
|
postBuild = stdenv.lib.optionalString stdenv.isLinux ''
|
2013-11-14 03:55:54 -08:00
|
|
|
|
paxmark mr src/polkitbackend/.libs/polkitd
|
2018-06-16 18:24:27 -07:00
|
|
|
|
'' + stdenv.lib.optionalString (stdenv.isLinux && doCheck) ''
|
2013-11-14 03:55:54 -08:00
|
|
|
|
paxmark mr test/polkitbackend/.libs/polkitbackendjsauthoritytest
|
|
|
|
|
'';
|
|
|
|
|
|
2018-07-06 13:41:41 -07:00
|
|
|
|
installFlags=["datadir=$(out)/share" "sysconfdir=$(out)/etc"];
|
|
|
|
|
|
2018-06-15 19:57:44 -07:00
|
|
|
|
inherit doCheck;
|
2018-07-06 13:41:41 -07:00
|
|
|
|
checkInputs = [dbus];
|
|
|
|
|
checkPhase = ''
|
|
|
|
|
# tests need access to the system bus
|
|
|
|
|
dbus-run-session --config-file=${./system_bus.conf} -- sh -c 'DBUS_SYSTEM_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS make check'
|
|
|
|
|
'';
|
2009-08-16 05:03:45 -07:00
|
|
|
|
|
2010-05-15 02:54:56 -07:00
|
|
|
|
meta = with stdenv.lib; {
|
2012-08-21 05:34:59 -07:00
|
|
|
|
homepage = http://www.freedesktop.org/wiki/Software/polkit;
|
2009-08-13 00:55:11 -07:00
|
|
|
|
description = "A toolkit for defining and handling the policy that allows unprivileged processes to speak to privileged processes";
|
2018-06-15 19:57:44 -07:00
|
|
|
|
platforms = platforms.unix;
|
2017-03-27 10:11:17 -07:00
|
|
|
|
maintainers = [ ];
|
2009-08-13 00:55:11 -07:00
|
|
|
|
};
|
|
|
|
|
}
|