From 5c570ab3fc90ca689a9f01c0bffd2470130738ba Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 1 Sep 2021 13:35:05 +0200 Subject: ma nix-community: add mediawiki-matrix-bot --- makefu/1systems/gum/config.nix | 3 ++- .../nix-community/mediawiki-matrix-bot.nix | 23 ++++++++++++++++++++++ .../5pkgs/custom/mediawiki-matrix-bot/default.nix | 22 +++++++++++++++++++++ makefu/5pkgs/mediawiki-matrix-bot/default.nix | 22 --------------------- 4 files changed, 47 insertions(+), 23 deletions(-) create mode 100644 makefu/2configs/nix-community/mediawiki-matrix-bot.nix create mode 100644 makefu/5pkgs/custom/mediawiki-matrix-bot/default.nix delete mode 100644 makefu/5pkgs/mediawiki-matrix-bot/default.nix diff --git a/makefu/1systems/gum/config.nix b/makefu/1systems/gum/config.nix index 1cfa8e4a4..adf025fd3 100644 --- a/makefu/1systems/gum/config.nix +++ b/makefu/1systems/gum/config.nix @@ -23,6 +23,7 @@ in { } + # @@ -182,7 +183,7 @@ in { # krebs infrastructure services - + # ]; makefu.dl-dir = "/var/download"; diff --git a/makefu/2configs/nix-community/mediawiki-matrix-bot.nix b/makefu/2configs/nix-community/mediawiki-matrix-bot.nix new file mode 100644 index 000000000..6dff64121 --- /dev/null +++ b/makefu/2configs/nix-community/mediawiki-matrix-bot.nix @@ -0,0 +1,23 @@ +{ pkgs, ... }: +let + seccfg = toString ; + statecfg = "/var/lib/mediawiki-matrix-bot/config.json"; +in { + systemd.services.mediawiki-matrix-bot = { + description = "Mediawiki Matrix Bot"; + after = [ "network-online.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Restart = "always"; + RestartSec = "60s"; + DynamicUser = true; + StateDirectory = "mediawiki-matrix-bot"; + PermissionsStartOnly = true; + ExecStartPre = pkgs.writeDash "mediawikibot-copy-config" '' + install -D -m644 ${seccfg} ${statecfg} + ''; + ExecStart = "${pkgs.mediawiki-matrix-bot}/bin/mediawiki-matrix-bot ${statecfg}"; + PrivateTmp = true; + }; + }; +} diff --git a/makefu/5pkgs/custom/mediawiki-matrix-bot/default.nix b/makefu/5pkgs/custom/mediawiki-matrix-bot/default.nix new file mode 100644 index 000000000..4a91a9161 --- /dev/null +++ b/makefu/5pkgs/custom/mediawiki-matrix-bot/default.nix @@ -0,0 +1,22 @@ +{ buildPythonApplication, fetchFromGitHub, feedparser, matrix-nio, docopt, aiohttp, aiofiles, +mypy }: + +buildPythonApplication rec { + pname = "mediawiki-matrix-bot"; + version = "1.0.0"; + src = fetchFromGitHub { + owner = "nix-community"; + repo = "mediawiki-matrix-bot"; + rev = "v${version}"; + sha256 = "1923097j1xh34jmm0zhmvma614jcxaagj89c1fc1j2qyv14ybsvs"; + }; + propagatedBuildInputs = [ + feedparser matrix-nio docopt aiohttp aiofiles + ]; + nativeBuildInputs = [ + mypy + ]; + checkPhase = '' + mypy --strict mediawiki_matrix_bot + ''; +} diff --git a/makefu/5pkgs/mediawiki-matrix-bot/default.nix b/makefu/5pkgs/mediawiki-matrix-bot/default.nix deleted file mode 100644 index 4a91a9161..000000000 --- a/makefu/5pkgs/mediawiki-matrix-bot/default.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ buildPythonApplication, fetchFromGitHub, feedparser, matrix-nio, docopt, aiohttp, aiofiles, -mypy }: - -buildPythonApplication rec { - pname = "mediawiki-matrix-bot"; - version = "1.0.0"; - src = fetchFromGitHub { - owner = "nix-community"; - repo = "mediawiki-matrix-bot"; - rev = "v${version}"; - sha256 = "1923097j1xh34jmm0zhmvma614jcxaagj89c1fc1j2qyv14ybsvs"; - }; - propagatedBuildInputs = [ - feedparser matrix-nio docopt aiohttp aiofiles - ]; - nativeBuildInputs = [ - mypy - ]; - checkPhase = '' - mypy --strict mediawiki_matrix_bot - ''; -} -- cgit v1.2.3