2009-08-17 01:16:38 +00:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
2010-07-23 14:23:08 +00:00
|
|
|
let
|
|
|
|
|
|
|
|
# `pam_console' maintains the set of locally logged in users in
|
|
|
|
# /var/run/console. This is obsolete, but D-Bus still uses it for
|
|
|
|
# its `at_console' feature. So maintain it using a ConsoleKit
|
|
|
|
# session script. Borrowed from
|
|
|
|
# http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-auth/consolekit/files/pam-foreground-compat.ck
|
|
|
|
updateVarRunConsole = pkgs.writeTextFile {
|
|
|
|
name = "var-run-console.ck";
|
|
|
|
destination = "/etc/ConsoleKit/run-session.d/var-run-console.ck";
|
|
|
|
executable = true;
|
|
|
|
|
|
|
|
text =
|
|
|
|
''
|
|
|
|
#! ${pkgs.stdenv.shell} -e
|
|
|
|
PATH=${pkgs.coreutils}/bin:${pkgs.gnused}/bin:${pkgs.glibc}/bin
|
|
|
|
TAGDIR=/var/run/console
|
|
|
|
|
|
|
|
exec >> /tmp/xyzzy 2>&1
|
|
|
|
|
|
|
|
[ -n "$CK_SESSION_USER_UID" ] || exit 1
|
|
|
|
|
|
|
|
TAGFILE="$TAGDIR/`getent passwd $CK_SESSION_USER_UID | cut -f 1 -d:`"
|
|
|
|
|
|
|
|
if [ "$1" = "session_added" ]; then
|
|
|
|
mkdir -p "$TAGDIR"
|
|
|
|
echo "$CK_SESSION_ID" >> "$TAGFILE"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "session_removed" ] && [ -e "$TAGFILE" ]; then
|
|
|
|
sed -i "\%^$CK_SESSION_ID\$%d" "$TAGFILE"
|
|
|
|
[ -s "$TAGFILE" ] || rm -f "$TAGFILE"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2009-08-17 01:16:38 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
2009-09-25 20:12:35 +00:00
|
|
|
environment.systemPackages = [ pkgs.consolekit ];
|
2009-08-17 01:16:38 +00:00
|
|
|
|
2009-09-25 20:12:35 +00:00
|
|
|
services.dbus.packages = [ pkgs.consolekit ];
|
2009-08-17 01:16:38 +00:00
|
|
|
|
|
|
|
environment.etc = singleton
|
|
|
|
{ source = (pkgs.buildEnv {
|
2009-09-25 20:12:35 +00:00
|
|
|
name = "consolekit-config";
|
2009-08-17 01:16:38 +00:00
|
|
|
pathsToLink = [ "/etc/ConsoleKit" ];
|
2010-07-23 14:23:08 +00:00
|
|
|
paths = [ pkgs.consolekit pkgs.udev updateVarRunConsole ];
|
2009-08-17 01:16:38 +00:00
|
|
|
}) + "/etc/ConsoleKit";
|
|
|
|
target = "ConsoleKit";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|