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