2017-05-25 17:05:46 +01:00
|
|
|
|
{ stdenv, fetchurl, fetchpatch, autoreconfHook, pkgconfig, glib, expat, pam
|
|
|
|
|
, intltool, spidermonkey_17 , gobjectIntrospection, libxslt, docbook_xsl
|
2018-02-25 02:23:58 +00:00
|
|
|
|
, docbook_xml_dtd_412, gtk-doc
|
2017-05-25 17:05:46 +01:00
|
|
|
|
, useSystemd ? stdenv.isLinux, systemd
|
2018-06-16 03:57:44 +01:00
|
|
|
|
, doCheck ? false
|
2017-05-25 17:05:46 +01:00
|
|
|
|
}:
|
2009-08-13 08:55:11 +01:00
|
|
|
|
|
2010-05-15 10:55:31 +01:00
|
|
|
|
let
|
2011-07-07 19:16:03 +01:00
|
|
|
|
|
|
|
|
|
system = "/var/run/current-system/sw";
|
2017-01-29 10:11:01 +00:00
|
|
|
|
setuid = "/run/wrappers/bin"; #TODO: from <nixos> config.security.wrapperDir;
|
2012-08-21 13:34:59 +01:00
|
|
|
|
|
2010-05-15 10:55:31 +01:00
|
|
|
|
foolVars = {
|
|
|
|
|
SYSCONF = "/etc";
|
2013-11-09 15:29:18 +00:00
|
|
|
|
DATA = "${system}/share"; # to find share/polkit-1/actions of other apps at runtime
|
2010-05-15 10:55:31 +01:00
|
|
|
|
};
|
2012-08-21 13:34:59 +01:00
|
|
|
|
|
2010-05-15 10:55:31 +01:00
|
|
|
|
in
|
|
|
|
|
|
2009-08-13 08:55:11 +01:00
|
|
|
|
stdenv.mkDerivation rec {
|
2015-07-07 08:01:33 +01:00
|
|
|
|
name = "polkit-0.113";
|
2010-05-15 10:55:31 +01:00
|
|
|
|
|
2009-08-13 08:55:11 +01:00
|
|
|
|
src = fetchurl {
|
2018-06-28 19:43:35 +01:00
|
|
|
|
url = "https://www.freedesktop.org/software/polkit/releases/${name}.tar.gz";
|
2015-07-07 08:01:33 +01:00
|
|
|
|
sha256 = "109w86kfqrgz83g9ivggplmgc77rz8kx8646izvm2jb57h4rbh71";
|
2009-08-13 08:55:11 +01:00
|
|
|
|
};
|
2010-05-15 10:55:31 +01:00
|
|
|
|
|
2017-05-25 17:05:46 +01:00
|
|
|
|
patches = [
|
|
|
|
|
(fetchpatch {
|
2018-02-08 21:38:06 +00:00
|
|
|
|
url = "http://src.fedoraproject.org/cgit/rpms/polkit.git/plain/polkit-0.113-agent-leaks.patch?id=fa6fd575804de92886c95d3bc2b7eb2abcd13760";
|
2017-05-25 17:05:46 +01:00
|
|
|
|
sha256 = "1cxnhj0y30g7ldqq1y6zwsbdwcx7h97d3mpd3h5jy7dhg3h9ym91";
|
|
|
|
|
})
|
|
|
|
|
(fetchpatch {
|
2018-02-08 21:38:06 +00:00
|
|
|
|
url = "http://src.fedoraproject.org/cgit/rpms/polkit.git/plain/polkit-0.113-polkitpermission-leak.patch?id=fa6fd575804de92886c95d3bc2b7eb2abcd13760";
|
2017-05-25 17:05:46 +01:00
|
|
|
|
sha256 = "1h1rkd4avqyyr8q6836zzr3w10jf521gcqnvhrhzwdpgp1ay4si7";
|
|
|
|
|
})
|
|
|
|
|
(fetchpatch {
|
2018-02-08 21:38:06 +00:00
|
|
|
|
url = "http://src.fedoraproject.org/cgit/rpms/polkit.git/plain/polkit-0.113-itstool.patch?id=fa6fd575804de92886c95d3bc2b7eb2abcd13760";
|
2017-05-25 17:05:46 +01:00
|
|
|
|
sha256 = "0bxmjwp8ahy1y5g1l0kxmld0l3mlvb2l0i5n1qabia3d5iyjkyfh";
|
|
|
|
|
})
|
2018-06-16 03:57:44 +01:00
|
|
|
|
(fetchpatch {
|
|
|
|
|
name = "netgroup-optional.patch";
|
|
|
|
|
url = "https://bugs.freedesktop.org/attachment.cgi?id=118753";
|
|
|
|
|
sha256 = "1zq51dhmqi9zi86bj9dq4i4pxlxm41k3k4a091j07bd78cjba038";
|
|
|
|
|
})
|
|
|
|
|
];
|
2018-01-14 21:14:28 +00:00
|
|
|
|
|
2018-06-16 03:57:44 +01:00
|
|
|
|
postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
|
sed -i -e "s/-Wl,--as-needed//" configure.ac
|
|
|
|
|
'';
|
2017-05-25 17:05:46 +01:00
|
|
|
|
|
2016-08-29 01:30:01 +01:00
|
|
|
|
outputs = [ "bin" "dev" "out" ]; # small man pages in $bin
|
2015-10-14 05:03:25 +01:00
|
|
|
|
|
2017-05-25 17:05:46 +01:00
|
|
|
|
nativeBuildInputs =
|
2018-02-25 02:23:58 +00:00
|
|
|
|
[ gtk-doc pkgconfig autoreconfHook intltool gobjectIntrospection ]
|
2017-05-25 17:05:46 +01:00
|
|
|
|
++ [ libxslt docbook_xsl docbook_xml_dtd_412 ]; # man pages
|
2011-07-07 19:16:03 +01:00
|
|
|
|
buildInputs =
|
2017-09-19 17:29:30 +01:00
|
|
|
|
[ glib expat pam spidermonkey_17 gobjectIntrospection ]
|
2012-08-21 13:34:59 +01:00
|
|
|
|
++ stdenv.lib.optional useSystemd systemd;
|
2009-08-13 08:55:11 +01:00
|
|
|
|
|
2010-05-15 10:55:31 +01:00
|
|
|
|
# Ugly hack to overwrite hardcoded directories
|
|
|
|
|
# TODO: investigate a proper patch which will be accepted upstream
|
2013-11-09 15:29:18 +00:00
|
|
|
|
# After update it's good to check the sources via:
|
|
|
|
|
# grep '\<PACKAGE_' '--include=*.[ch]' -R
|
2010-05-15 10:55:31 +01:00
|
|
|
|
CFLAGS = stdenv.lib.concatStringsSep " "
|
|
|
|
|
( map (var: ''-DPACKAGE_${var}_DIR=\""${builtins.getAttr var foolVars}"\"'')
|
2011-07-07 19:16:03 +01:00
|
|
|
|
(builtins.attrNames foolVars) );
|
2009-08-16 22:47:51 +01:00
|
|
|
|
|
2015-01-08 09:26:49 +00:00
|
|
|
|
preConfigure = ''
|
|
|
|
|
patchShebangs .
|
|
|
|
|
'' + stdenv.lib.optionalString useSystemd /* bogus chroot detection */ ''
|
2015-07-07 08:01:33 +01:00
|
|
|
|
sed '/libsystemd autoconfigured/s/.*/:/' -i configure
|
2013-11-09 15:29:18 +00: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}/'
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
|
#"--libexecdir=$(out)/libexec/polkit-1" # this and localstatedir are ignored by configure
|
|
|
|
|
"--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 23:15:51 +00:00
|
|
|
|
"--enable-introspection"
|
2018-06-16 03:57:44 +01:00
|
|
|
|
] ++ stdenv.lib.optional (!doCheck) "--disable-test";
|
2011-08-22 12:45:51 +01:00
|
|
|
|
|
2014-01-25 23:15:51 +00:00
|
|
|
|
makeFlags = "INTROSPECTION_GIRDIR=$(out)/share/gir-1.0 INTROSPECTION_TYPELIBDIR=$(out)/lib/girepository-1.0";
|
2012-08-21 13:34:59 +01:00
|
|
|
|
|
2013-11-14 11:55:54 +00:00
|
|
|
|
# The following is required on grsecurity/PaX due to spidermonkey's JIT
|
2018-06-16 03:57:44 +01:00
|
|
|
|
postBuild = stdenv.lib.optionalString stdenv.isLinux ''
|
2013-11-14 11:55:54 +00:00
|
|
|
|
paxmark mr src/polkitbackend/.libs/polkitd
|
2018-06-17 02:24:27 +01:00
|
|
|
|
'' + stdenv.lib.optionalString (stdenv.isLinux && doCheck) ''
|
2013-11-14 11:55:54 +00:00
|
|
|
|
paxmark mr test/polkitbackend/.libs/polkitbackendjsauthoritytest
|
|
|
|
|
'';
|
|
|
|
|
|
2018-06-16 03:57:44 +01:00
|
|
|
|
inherit doCheck;
|
2009-08-16 13:03:45 +01:00
|
|
|
|
|
2010-05-15 10:54:56 +01:00
|
|
|
|
meta = with stdenv.lib; {
|
2012-08-21 13:34:59 +01:00
|
|
|
|
homepage = http://www.freedesktop.org/wiki/Software/polkit;
|
2009-08-13 08:55:11 +01:00
|
|
|
|
description = "A toolkit for defining and handling the policy that allows unprivileged processes to speak to privileged processes";
|
2018-06-16 03:57:44 +01:00
|
|
|
|
platforms = platforms.unix;
|
2017-03-27 18:11:17 +01:00
|
|
|
|
maintainers = [ ];
|
2009-08-13 08:55:11 +01:00
|
|
|
|
};
|
|
|
|
|
}
|