Supybot service: failing to create stateDir in /var/lib
This commit is contained in:
parent
90554a03c7
commit
6e093113fe
@ -5,7 +5,6 @@ with pkgs.lib;
|
|||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.services.supybot;
|
cfg = config.services.supybot;
|
||||||
configFile = pkgs.writeText "supybot.cfg" cfg.config;
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
@ -19,19 +18,19 @@ in
|
|||||||
|
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
description = "Enable the supybot IRC bot";
|
description = "Enable Supybot, an IRC bot";
|
||||||
};
|
};
|
||||||
|
|
||||||
homeDir = mkOption {
|
stateDir = mkOption {
|
||||||
default = "/home/supybot";
|
default = "/var/lib/supybot";
|
||||||
description = "
|
description = "
|
||||||
Directory holding all state for nginx to run.
|
|
||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkOption {
|
configFile = mkOption {
|
||||||
type = types.lines;
|
type = types.path;
|
||||||
default = "";
|
default = /dev/null;
|
||||||
description = ''
|
description = ''
|
||||||
Verbatim contents of the supybot config, this can be
|
Verbatim contents of the supybot config, this can be
|
||||||
generated by supybot-wizard
|
generated by supybot-wizard
|
||||||
@ -56,7 +55,7 @@ in
|
|||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.pythonPackages.limnoria ];
|
environment.systemPackages = [ pkgs.pythonPackages.limnoria ];
|
||||||
|
|
||||||
users.extraUsers = singleton
|
users.extraUsers = singleton
|
||||||
@ -64,9 +63,9 @@ in
|
|||||||
uid = config.ids.uids.supybot;
|
uid = config.ids.uids.supybot;
|
||||||
group = "supybot";
|
group = "supybot";
|
||||||
description = "Supybot IRC bot user";
|
description = "Supybot IRC bot user";
|
||||||
home = cfg.homeDir;
|
home = cfg.stateDir;
|
||||||
createHome = true;
|
createHome = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
users.extraGroups.supybot = {};
|
users.extraGroups.supybot = {};
|
||||||
|
|
||||||
@ -76,14 +75,18 @@ in
|
|||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
path = [ pkgs.pythonPackages.limnoria ];
|
path = [ pkgs.pythonPackages.limnoria ];
|
||||||
preStart = ''
|
preStart = ''
|
||||||
cd ${cfg.homeDir}
|
mkdir -m 0755 -p ${cfg.stateDir}
|
||||||
|
chown ${cfg.user}:${cfg.group} ${cfg.stateDir}
|
||||||
|
cd ${cfg.stateDir}
|
||||||
mkdir -p logs/plugins backup conf data plugins tmp
|
mkdir -p logs/plugins backup conf data plugins tmp
|
||||||
|
ln -sf ${cfg.configFile} supybot.cfg
|
||||||
|
rm -f supybot.cfg.bak
|
||||||
'';
|
'';
|
||||||
serviceConfig =
|
serviceConfig =
|
||||||
{ ExecStart =
|
{ ExecStart =
|
||||||
"${pkgs.pythonPackages.limnoria}/bin/supybot ${cfg.homeDir}/supybot.cfg";
|
"${pkgs.pythonPackages.limnoria}/bin/supybot ${cfg.stateDir}/supybot.cfg";
|
||||||
PIDFile = "/run/supybot.pid";
|
PIDFile = "/run/supybot.pid";
|
||||||
User = "${cfg.user}";
|
User = "${cfg.user}";
|
||||||
Group = "${cfg.group}";
|
Group = "${cfg.group}";
|
||||||
UMask = "0007";
|
UMask = "0007";
|
||||||
Restart = "on-abort";
|
Restart = "on-abort";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user