forked from M-Labs/it-infra
parent
c6c392d10f
commit
5322606804
|
@ -15,7 +15,6 @@ in
|
|||
imports =
|
||||
[
|
||||
./hardware-configuration.nix
|
||||
./homu/nixos-module.nix
|
||||
./backup-module.nix
|
||||
(builtins.fetchTarball {
|
||||
url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/v2.3.0/nixos-mailserver-v2.3.0.tar.gz";
|
||||
|
@ -515,7 +514,6 @@ in
|
|||
auth_basic "Munin";
|
||||
auth_basic_user_file /etc/nixos/secret/muninpasswd;
|
||||
'';
|
||||
locations."/homu/".proxyPass = "http://127.0.0.1:54856/";
|
||||
};
|
||||
"nixbld.m-labs.hk" = {
|
||||
forceSSL = true;
|
||||
|
@ -640,11 +638,6 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
services.homu = {
|
||||
enable = true;
|
||||
config = "/etc/nixos/secret/homu.toml";
|
||||
};
|
||||
|
||||
mailserver = {
|
||||
enable = true;
|
||||
localDnsResolver = false; # conflicts with dnsmasq
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/homu/git_helper.py b/homu/git_helper.py
|
||||
index 0f70c69..f53fb57 100755
|
||||
--- a/homu/git_helper.py
|
||||
+++ b/homu/git_helper.py
|
||||
@@ -7,7 +7,7 @@ SSH_KEY_FILE = os.path.join(os.path.dirname(__file__), '../cache/key')
|
||||
|
||||
|
||||
def main():
|
||||
- args = ['ssh', '-i', SSH_KEY_FILE, '-S', 'none'] + sys.argv[1:]
|
||||
+ args = ['ssh', '-o', 'StrictHostKeyChecking=no', '-i', SSH_KEY_FILE, '-S', 'none'] + sys.argv[1:]
|
||||
os.execvp('ssh', args)
|
||||
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
homu = pkgs.callPackage ./pkg.nix {};
|
||||
cfg = config.services.homu;
|
||||
in
|
||||
|
||||
{
|
||||
options.services.homu = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable the bot";
|
||||
};
|
||||
dbDir = mkOption {
|
||||
type = types.str;
|
||||
default = "/var/db/homu";
|
||||
description = "Path to the database file (use the same path in config.toml)";
|
||||
};
|
||||
config = mkOption {
|
||||
description = "Location of config.toml";
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.users.homu = {
|
||||
group = "homu";
|
||||
home = cfg.dbDir;
|
||||
createHome = true;
|
||||
};
|
||||
users.groups.homu = {};
|
||||
|
||||
systemd.services.homu = {
|
||||
description = "Homu bot";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${homu}/bin/homu -c ${cfg.config}";
|
||||
|
||||
Restart = "always";
|
||||
RestartSec = "5sec";
|
||||
|
||||
User = "homu";
|
||||
Group = "homu";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
diff --git a/homu/git_helper.py b/homu/git_helper.py
|
||||
index 0f70c69..732230c 100755
|
||||
--- a/homu/git_helper.py
|
||||
+++ b/homu/git_helper.py
|
||||
@@ -3,7 +3,7 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
-SSH_KEY_FILE = os.path.join(os.path.dirname(__file__), '../cache/key')
|
||||
+SSH_KEY_FILE = os.path.expanduser("~/cache/key")
|
||||
|
||||
|
||||
def main():
|
||||
diff --git a/homu/main.py b/homu/main.py
|
||||
index 16b60a2..a2e109a 100644
|
||||
--- a/homu/main.py
|
||||
+++ b/homu/main.py
|
||||
@@ -649,7 +649,7 @@ def git_push(git_cmd, branch, state):
|
||||
|
||||
|
||||
def init_local_git_cmds(repo_cfg, git_cfg):
|
||||
- fpath = 'cache/{}/{}'.format(repo_cfg['owner'], repo_cfg['name'])
|
||||
+ fpath = '{}/cache/{}/{}'.format(os.path.expanduser("~"), repo_cfg['owner'], repo_cfg['name'])
|
||||
url = 'git@github.com:{}/{}.git'.format(repo_cfg['owner'], repo_cfg['name']) # noqa
|
||||
|
||||
if not os.path.exists(SSH_KEY_FILE):
|
|
@ -1,34 +0,0 @@
|
|||
{ python3Packages, python3, fetchFromGitHub, git, openssh }:
|
||||
|
||||
let
|
||||
uritemplate_0_2_0 = python3Packages.github3_py.overrideAttrs(oa: rec {
|
||||
version = "0.2.0";
|
||||
src = python3Packages.fetchPypi {
|
||||
pname = "uritemplate.py";
|
||||
inherit version;
|
||||
sha256 = "1pfk04pmnysz0383lwzgig8zqlwiv2n4pmq51f0mc60zz1jimq4g";
|
||||
};
|
||||
});
|
||||
github3_py_0_9_6 = python3Packages.github3_py.overrideAttrs(oa: rec {
|
||||
version = "0.9.6";
|
||||
src = python3Packages.fetchPypi {
|
||||
pname = "github3.py";
|
||||
inherit version;
|
||||
sha256 = "1i8xnh586z4kka7pjl7cy08fmzjs14c8jdp8ykb9jjpzsy2xncdq";
|
||||
};
|
||||
propagatedBuildInputs = [ python3Packages.requests uritemplate_0_2_0 ];
|
||||
});
|
||||
in
|
||||
python3Packages.buildPythonApplication {
|
||||
name = "homu";
|
||||
src = fetchFromGitHub {
|
||||
owner = "servo";
|
||||
repo = "homu";
|
||||
rev = "2ea53e76ebac3e5fa11bc39054b3cd4c42eff607";
|
||||
sha256 = "1ih7s8zfbpq0qb9vqbxzr0r4s9ff52l4ipr916kwbck3ygliq3r9";
|
||||
};
|
||||
patches = [ ./patch-cache-directory.patch ./disable-ssh-host-keycheck.patch ];
|
||||
postInstall = "chmod 755 $out/${python3.sitePackages}/homu/git_helper.py";
|
||||
propagatedBuildInputs = [ github3_py_0_9_6 git openssh ] ++ (with python3Packages; [ toml jinja2 requests bottle waitress retrying ]);
|
||||
checkPhase = "python -m unittest discover tests -v";
|
||||
}
|
Loading…
Reference in New Issue