···
+
{ config, lib, pkgs, ... }:
+
cfg = config.services.nixbot;
+
# http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/narr/environment.html
+
nixbot.github_token = ${cfg.githubToken}
+
nixbot.bot_name = ${cfg.botName}
+
nixbot.repo = ${cfg.repo}
+
nixbot.pr_repo = ${cfg.prRepo}
+
nixbot.hydra_jobsets_repo = ${cfg.hydraJobsetsRepo}
+
nixbot.github_secret = justnotsorandom
+
nixbot.public_url = ${cfg.publicUrl}
+
nixbot.repo_dir = ${cfg.repoDir}
+
pyramid.reload_templates = false
+
pyramid.debug_authorization = false
+
pyramid.debug_notfound = false
+
pyramid.debug_routematch = false
+
pyramid.default_locale_name = en
+
# By default, the toolbar only appears for clients from IP addresses
+
# '127.0.0.1' and '::1'.
+
# debugtoolbar.hosts = 127.0.0.1 ::1
+
# wsgi server configuration
+
use = egg:waitress#main
+
# logging configuration
+
# http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/narr/logging.html
+
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
+
enable = mkEnableOption "nixbot";
+
description = "The bot's github user account name.";
+
githubToken = mkOption {
+
description = "The bot's github user account token.";
+
example = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
+
description = "The github repository to check for PRs.";
+
example = "nixos/nixpkgs";
+
description = "The github repository to push the testing branches to.";
+
example = "nixos/nixpkgs-pr";
+
hydraJobsetsRepo = mkOption {
+
description = "The github repository to push the hydra jobset definitions to.";
+
example = "nixos/hydra-jobsets";
+
description = "The public URL the bot is reachable at (Github hook endpoint).";
+
example = "https://nixbot.nixos.org";
+
description = "The directory the repositories are stored in.";
+
default = "/var/lib/nixbot";
+
config = mkIf cfg.enable {
+
users.extraUsers.nixbot = {
+
systemd.services.nixbot = let
+
env = pkgs.python3.buildEnv.override {
+
extraLibs = [ pkgs.nixbot ];
+
after = [ "network.target" ];
+
wantedBy = [ "multi-user.target" ];
+
${env}/bin/pserve ${pkgs.writeText "production.ini" pyramidIni}
+
PermissionsStartOnly = true;