···
1
+
{ config, lib, pkgs, ... }:
6
+
cfg = config.services.nixbot;
10
+
# http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/narr/environment.html
16
+
nixbot.github_token = ${cfg.githubToken}
17
+
nixbot.bot_name = ${cfg.botName}
18
+
nixbot.repo = ${cfg.repo}
19
+
nixbot.pr_repo = ${cfg.prRepo}
20
+
nixbot.hydra_jobsets_repo = ${cfg.hydraJobsetsRepo}
21
+
nixbot.github_secret = justnotsorandom
22
+
nixbot.public_url = ${cfg.publicUrl}
23
+
nixbot.repo_dir = ${cfg.repoDir}
25
+
pyramid.reload_templates = false
26
+
pyramid.debug_authorization = false
27
+
pyramid.debug_notfound = false
28
+
pyramid.debug_routematch = false
29
+
pyramid.default_locale_name = en
31
+
# By default, the toolbar only appears for clients from IP addresses
32
+
# '127.0.0.1' and '::1'.
33
+
# debugtoolbar.hosts = 127.0.0.1 ::1
36
+
# wsgi server configuration
40
+
use = egg:waitress#main
45
+
# logging configuration
46
+
# http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/narr/logging.html
68
+
class = StreamHandler
69
+
args = (sys.stderr,)
74
+
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
79
+
enable = mkEnableOption "nixbot";
81
+
botName = mkOption {
83
+
description = "The bot's github user account name.";
87
+
githubToken = mkOption {
89
+
description = "The bot's github user account token.";
90
+
example = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
95
+
description = "The github repository to check for PRs.";
96
+
example = "nixos/nixpkgs";
101
+
description = "The github repository to push the testing branches to.";
102
+
example = "nixos/nixpkgs-pr";
105
+
hydraJobsetsRepo = mkOption {
107
+
description = "The github repository to push the hydra jobset definitions to.";
108
+
example = "nixos/hydra-jobsets";
111
+
publicUrl = mkOption {
113
+
description = "The public URL the bot is reachable at (Github hook endpoint).";
114
+
example = "https://nixbot.nixos.org";
117
+
repoDir = mkOption {
119
+
description = "The directory the repositories are stored in.";
120
+
default = "/var/lib/nixbot";
125
+
config = mkIf cfg.enable {
126
+
users.extraUsers.nixbot = {
128
+
home = cfg.repoDir;
131
+
systemd.services.nixbot = let
132
+
env = pkgs.python3.buildEnv.override {
133
+
extraLibs = [ pkgs.nixbot ];
136
+
after = [ "network.target" ];
137
+
wantedBy = [ "multi-user.target" ];
139
+
${env}/bin/pserve ${pkgs.writeText "production.ini" pyramidIni}
145
+
PermissionsStartOnly = true;