Reaktor: introduce <botname>.workdir

This commit is contained in:
makefu 2017-07-28 23:06:40 +02:00
parent b28d64255a
commit 9884b522fe
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225

View File

@ -4,8 +4,7 @@ with import <stockholm/lib>;
let
cfg = config.krebs.Reaktor;
workdir = "/var/lib/Reaktor";
homedir = "/var/lib/Reaktor";
out = {
options.krebs.Reaktor = api;
@ -38,6 +37,14 @@ let
default = [pkgs.ReaktorPlugins.nixos-version];
};
workdir = mkOption {
default = "/var/lib/Reaktor";
type = types.path;
description = ''
path to be used as workdir (home dir is still /var/lib/Reaktor)
'';
};
extraConfig = mkOption {
default = "";
type = types.string;
@ -84,7 +91,7 @@ let
name = "Reaktor";
uid = genid name;
description = "Reaktor user";
home = workdir;
home = homedir;
createHome = true;
};
@ -118,7 +125,7 @@ let
REAKTOR_NICKNAME = botcfg.nickname;
REAKTOR_DEBUG = (if botcfg.debug then "True" else "False");
REAKTOR_CHANNELS = lib.concatStringsSep "," botcfg.channels;
state_dir = workdir;
state_dir = botcfg.workdir;
} // botcfg.extraEnviron;
serviceConfig= {
@ -129,6 +136,7 @@ let
else
''(${pkgs.Reaktor}/bin/reaktor get-config;cat "${ReaktorConfig}" ) > /tmp/reaktor-${name}-config.py''
}
mkdir -p ${botcfg.workdir}
'';
ExecStart = "${pkgs.Reaktor}/bin/reaktor run /tmp/reaktor-${name}-config.py";
PrivateTmp = "true";