From b4ca59e17fc585054dc4b92a1cab7a494a748a8f Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Mon, 22 Aug 2011 11:45:51 +0000
Subject: [PATCH] =?UTF-8?q?*=20Polkit:=20look=20for=20=E2=80=98polkit-agen?=
 =?UTF-8?q?t-helper-1=E2=80=99=20in=20the=20right=20location=20(for=20=20?=
 =?UTF-8?q?=20NixOS,=20that=20is),=20i.e.,=20/var/setuid-wrappers.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

svn path=/nixpkgs/trunk/; revision=28733
---
 pkgs/development/libraries/polkit/default.nix | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/pkgs/development/libraries/polkit/default.nix b/pkgs/development/libraries/polkit/default.nix
index 31b8d2f345a5..f2301a9621c2 100644
--- a/pkgs/development/libraries/polkit/default.nix
+++ b/pkgs/development/libraries/polkit/default.nix
@@ -33,6 +33,15 @@ stdenv.mkDerivation rec {
     ( map (var: ''-DPACKAGE_${var}_DIR=\""${builtins.getAttr var foolVars}"\"'')
         (builtins.attrNames foolVars) );
 
+  preBuild =
+    ''
+      # ‘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_LIBEXEC_DIR '"/var/setuid-wrappers"'
+    '';
+
   makeFlags =
     ''
       INTROSPECTION_GIRDIR=$(out)/share/gir-1.0