2013-11-09 16:29:18 +01:00
|
|
|
|
{ stdenv, fetchurl, pkgconfig, glib, expat, pam, intltool, spidermonkey
|
2014-08-25 09:48:01 +02:00
|
|
|
|
, gobjectIntrospection, libxslt, docbook_xsl, docbook_xml_dtd_412
|
2013-10-06 00:20:34 +02:00
|
|
|
|
, useSystemd ? stdenv.isLinux, systemd }:
|
2009-08-13 09:55:11 +02:00
|
|
|
|
|
2010-05-15 11:55:31 +02:00
|
|
|
|
let
|
2011-07-07 20:16:03 +02:00
|
|
|
|
|
|
|
|
|
system = "/var/run/current-system/sw";
|
2013-11-09 16:29:18 +01:00
|
|
|
|
setuid = "/var/setuid-wrappers"; #TODO: from <nixos> config.security.wrapperDir;
|
2012-08-21 14:34:59 +02:00
|
|
|
|
|
2010-05-15 11:55:31 +02:00
|
|
|
|
foolVars = {
|
|
|
|
|
SYSCONF = "/etc";
|
2013-11-09 16:29:18 +01:00
|
|
|
|
DATA = "${system}/share"; # to find share/polkit-1/actions of other apps at runtime
|
2010-05-15 11:55:31 +02:00
|
|
|
|
};
|
2012-08-21 14:34:59 +02:00
|
|
|
|
|
2010-05-15 11:55:31 +02:00
|
|
|
|
in
|
|
|
|
|
|
2009-08-13 09:55:11 +02:00
|
|
|
|
stdenv.mkDerivation rec {
|
2015-07-07 09:01:33 +02:00
|
|
|
|
name = "polkit-0.113";
|
2010-05-15 11:55:31 +02:00
|
|
|
|
|
2009-08-13 09:55:11 +02:00
|
|
|
|
src = fetchurl {
|
2012-08-21 14:34:59 +02:00
|
|
|
|
url = "http://www.freedesktop.org/software/polkit/releases/${name}.tar.gz";
|
2015-07-07 09:01:33 +02:00
|
|
|
|
sha256 = "109w86kfqrgz83g9ivggplmgc77rz8kx8646izvm2jb57h4rbh71";
|
2009-08-13 09:55:11 +02:00
|
|
|
|
};
|
2010-05-15 11:55:31 +02:00
|
|
|
|
|
2011-07-07 20:16:03 +02:00
|
|
|
|
buildInputs =
|
2013-11-09 16:29:18 +01:00
|
|
|
|
[ pkgconfig glib expat pam intltool spidermonkey gobjectIntrospection ]
|
2014-08-25 09:48:01 +02:00
|
|
|
|
++ [ libxslt docbook_xsl docbook_xml_dtd_412 ] # man pages
|
2012-08-21 14:34:59 +02:00
|
|
|
|
++ stdenv.lib.optional useSystemd systemd;
|
2009-08-13 09:55:11 +02:00
|
|
|
|
|
2010-05-15 11:55:31 +02:00
|
|
|
|
# Ugly hack to overwrite hardcoded directories
|
|
|
|
|
# TODO: investigate a proper patch which will be accepted upstream
|
2013-11-09 16:29:18 +01:00
|
|
|
|
# After update it's good to check the sources via:
|
|
|
|
|
# grep '\<PACKAGE_' '--include=*.[ch]' -R
|
2010-05-15 11:55:31 +02:00
|
|
|
|
CFLAGS = stdenv.lib.concatStringsSep " "
|
|
|
|
|
( map (var: ''-DPACKAGE_${var}_DIR=\""${builtins.getAttr var foolVars}"\"'')
|
2011-07-07 20:16:03 +02:00
|
|
|
|
(builtins.attrNames foolVars) );
|
2009-08-16 23:47:51 +02:00
|
|
|
|
|
2015-01-08 10:26:49 +01:00
|
|
|
|
preConfigure = ''
|
|
|
|
|
patchShebangs .
|
|
|
|
|
'' + stdenv.lib.optionalString useSystemd /* bogus chroot detection */ ''
|
2015-07-07 09:01:33 +02:00
|
|
|
|
sed '/libsystemd autoconfigured/s/.*/:/' -i configure
|
2013-11-09 16:29:18 +01: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-26 00:15:51 +01:00
|
|
|
|
"--enable-introspection"
|
2013-11-09 16:29:18 +01:00
|
|
|
|
];
|
2011-08-22 13:45:51 +02:00
|
|
|
|
|
2014-01-26 00:15:51 +01:00
|
|
|
|
makeFlags = "INTROSPECTION_GIRDIR=$(out)/share/gir-1.0 INTROSPECTION_TYPELIBDIR=$(out)/lib/girepository-1.0";
|
2012-08-21 14:34:59 +02:00
|
|
|
|
|
2013-11-14 12:55:54 +01:00
|
|
|
|
# The following is required on grsecurity/PaX due to spidermonkey's JIT
|
|
|
|
|
postBuild = ''
|
|
|
|
|
paxmark mr src/polkitbackend/.libs/polkitd
|
|
|
|
|
paxmark mr test/polkitbackend/.libs/polkitbackendjsauthoritytest
|
|
|
|
|
'';
|
|
|
|
|
|
2013-11-09 16:29:18 +01:00
|
|
|
|
#doCheck = true; # some /bin/bash problem that isn't auto-solved by patchShebangs
|
2009-08-16 14:03:45 +02:00
|
|
|
|
|
2010-05-15 11:54:56 +02:00
|
|
|
|
meta = with stdenv.lib; {
|
2012-08-21 14:34:59 +02:00
|
|
|
|
homepage = http://www.freedesktop.org/wiki/Software/polkit;
|
2009-08-13 09:55:11 +02:00
|
|
|
|
description = "A toolkit for defining and handling the policy that allows unprivileged processes to speak to privileged processes";
|
2010-05-15 11:54:56 +02:00
|
|
|
|
platforms = platforms.linux;
|
|
|
|
|
maintainers = [ maintainers.urkud ];
|
2009-08-13 09:55:11 +02:00
|
|
|
|
};
|
|
|
|
|
}
|