2009-08-16 22:48:46 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
2010-05-14 21:28:04 +01:00
|
|
|
let
|
|
|
|
pkWrapper = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "polkit-wrapper";
|
2010-05-18 17:46:32 +01:00
|
|
|
helper = "libexec/polkit-1/polkit-agent-helper-1";
|
2010-05-14 21:28:04 +01:00
|
|
|
buildInputs = [ pkgs.xorg.lndir ];
|
|
|
|
|
|
|
|
builder = pkgs.writeScript "pkwrap-builder" ''
|
|
|
|
source $stdenv/setup
|
|
|
|
|
2010-05-18 17:46:32 +01:00
|
|
|
mkdir -pv $out
|
2010-05-14 21:28:04 +01:00
|
|
|
lndir ${pkgs.polkit} $out
|
|
|
|
|
2010-05-18 17:46:32 +01:00
|
|
|
rm $out/$helper
|
|
|
|
ln -sv ${config.security.wrapperDir}/polkit-agent-helper-1 $out/$helper
|
2010-05-14 21:28:04 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
2009-08-16 22:48:46 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
2010-05-14 21:28:04 +01:00
|
|
|
environment = {
|
|
|
|
systemPackages = [ pkWrapper ];
|
|
|
|
pathsToLink = [ "/share/polkit-1" "/etc/polkit-1" ];
|
|
|
|
etc = [
|
|
|
|
{
|
|
|
|
source = "${config.system.path}/etc/polkit-1";
|
|
|
|
target = "polkit-1";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2009-08-16 22:48:46 +01:00
|
|
|
|
2010-05-14 21:28:04 +01:00
|
|
|
services.dbus.packages = [ pkWrapper ];
|
2009-08-16 22:48:46 +01:00
|
|
|
|
2010-05-14 21:28:04 +01:00
|
|
|
security = {
|
|
|
|
pam.services = [ { name = "polkit-1"; } ];
|
|
|
|
setuidPrograms = [ "pkexec" ];
|
2009-08-16 22:48:46 +01:00
|
|
|
|
2010-05-14 21:28:04 +01:00
|
|
|
setuidOwners = [
|
|
|
|
{
|
2010-05-18 17:46:32 +01:00
|
|
|
program = "polkit-agent-helper-1";
|
2010-05-14 21:28:04 +01:00
|
|
|
owner = "root";
|
|
|
|
group = "root";
|
|
|
|
setuid = true;
|
2010-05-18 17:46:32 +01:00
|
|
|
source = pkgs.polkit + "/" + pkWrapper.helper;
|
2010-05-14 21:28:04 +01:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2009-08-16 22:48:46 +01:00
|
|
|
|
2010-05-18 17:46:32 +01:00
|
|
|
system.activationScripts.polikit = pkgs.stringsWithDeps.noDepEntry
|
2009-08-16 22:48:46 +01:00
|
|
|
''
|
2010-05-18 17:46:32 +01:00
|
|
|
mkdir -p /var/lib/polkit-1/localauthority
|
|
|
|
chmod 700 /var/lib/polkit-1{/localauthority,}
|
2009-08-16 22:48:46 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2009-08-17 02:16:38 +01:00
|
|
|
}
|