From 5322606804562a7209900a74e7104c48036f37d2 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 2 Aug 2020 20:43:36 +0800 Subject: [PATCH] disable homu Not used anymore. --- nixbld-etc-nixos/configuration.nix | 7 --- .../homu/disable-ssh-host-keycheck.patch | 13 ----- nixbld-etc-nixos/homu/nixos-module.nix | 52 ------------------- .../homu/patch-cache-directory.patch | 26 ---------- nixbld-etc-nixos/homu/pkg.nix | 34 ------------ 5 files changed, 132 deletions(-) delete mode 100644 nixbld-etc-nixos/homu/disable-ssh-host-keycheck.patch delete mode 100644 nixbld-etc-nixos/homu/nixos-module.nix delete mode 100644 nixbld-etc-nixos/homu/patch-cache-directory.patch delete mode 100644 nixbld-etc-nixos/homu/pkg.nix diff --git a/nixbld-etc-nixos/configuration.nix b/nixbld-etc-nixos/configuration.nix index 285feabe..63dc93ec 100644 --- a/nixbld-etc-nixos/configuration.nix +++ b/nixbld-etc-nixos/configuration.nix @@ -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 diff --git a/nixbld-etc-nixos/homu/disable-ssh-host-keycheck.patch b/nixbld-etc-nixos/homu/disable-ssh-host-keycheck.patch deleted file mode 100644 index ef39ad97..00000000 --- a/nixbld-etc-nixos/homu/disable-ssh-host-keycheck.patch +++ /dev/null @@ -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) - - diff --git a/nixbld-etc-nixos/homu/nixos-module.nix b/nixbld-etc-nixos/homu/nixos-module.nix deleted file mode 100644 index 3f5574d3..00000000 --- a/nixbld-etc-nixos/homu/nixos-module.nix +++ /dev/null @@ -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"; - }; - }; - }; - -} - diff --git a/nixbld-etc-nixos/homu/patch-cache-directory.patch b/nixbld-etc-nixos/homu/patch-cache-directory.patch deleted file mode 100644 index 0cf2c90b..00000000 --- a/nixbld-etc-nixos/homu/patch-cache-directory.patch +++ /dev/null @@ -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): diff --git a/nixbld-etc-nixos/homu/pkg.nix b/nixbld-etc-nixos/homu/pkg.nix deleted file mode 100644 index 43cb2a0f..00000000 --- a/nixbld-etc-nixos/homu/pkg.nix +++ /dev/null @@ -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"; - }