Quassel: Create quassel user only if cfg.user is left empty to avoid messing up existing users.

This solution is still suboptimal but others are even worse.

svn path=/nixos/trunk/; revision=23927
This commit is contained in:
Evgeny Egorochkin 2010-09-26 01:58:44 +00:00
parent 26417566c4
commit d8c72719aa
1 changed files with 8 additions and 7 deletions

View File

@ -5,6 +5,7 @@ with pkgs.lib;
let
quassel = pkgs.quasselDaemon;
cfg = config.services.quassel;
user = if cfg.user != null then cfg.user else "quassel";
in
{
@ -39,16 +40,16 @@ in
};
dataDir = mkOption {
default = ''/home/${cfg.user}/.config/quassel-irc.org'';
default = ''/home/${user}/.config/quassel-irc.org'';
description = ''
The directory holding configuration files, the SQlite database and the SSL Cert.
'';
};
user = mkOption {
default = "quassel";
default = null;
description = ''
The user the Quassel daemon should run as.
The existing user the Quassel daemon should run as. If left empty, a default "quassel" user will be created.
'';
};
@ -61,10 +62,10 @@ in
config = mkIf cfg.enable {
users.extraUsers = singleton
users.extraUsers = mkIf (cfg.user == null) [
{ name = cfg.user;
description = "Quassel IRC client daemon";
};
}];
jobs.quassel =
@ -74,11 +75,11 @@ in
preStart = ''
mkdir -p ${cfg.dataDir}
chown ${cfg.user} ${cfg.dataDir}
chown ${user} ${cfg.dataDir}
'';
exec = ''
${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${cfg.user} \
${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${user} \
-c '${quassel}/bin/quasselcore --listen=${cfg.interface}\
--port=${toString cfg.portNumber} --configdir=${cfg.dataDir}'
'';