summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/stats
diff options
context:
space:
mode:
authornin <nin@c-base.org>2018-05-02 15:13:40 +0200
committernin <nin@c-base.org>2018-05-02 15:13:40 +0200
commit689fb1a77ad53722086da922de2de533460205b3 (patch)
tree408667e6aa15e1e0fa031e99c003c3968ba1578d /makefu/2configs/stats
parent702136442c5f8c4f7f1bb911bd21d238a164218a (diff)
parent37fa7bff9339799984554b8ccbacf1f07281d6ce (diff)
Merge branch 'master' of prism:stockholm
Diffstat (limited to 'makefu/2configs/stats')
-rw-r--r--makefu/2configs/stats/arafetch.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/makefu/2configs/stats/arafetch.nix b/makefu/2configs/stats/arafetch.nix
new file mode 100644
index 00000000..422676b2
--- /dev/null
+++ b/makefu/2configs/stats/arafetch.nix
@@ -0,0 +1,49 @@
+{ pkgs, lib, ...}:
+with import <stockholm/lib>;
+let
+ pkg = with pkgs.python3Packages;buildPythonPackage rec {
+ rev = "762d747";
+ name = "arafetch-${rev}";
+ propagatedBuildInputs = [
+ requests
+ docopt
+ influxdb
+ beautifulsoup4
+ ];
+ src = pkgs.fetchgit {
+ url = "http://cgit.euer.krebsco.de/arafetch";
+ inherit rev;
+ sha256 = "164xiqbrr914lz0nh3i1dxz8iwg6vm2af3i3803cd3242nznw0ws";
+ };
+ };
+ home = "/var/lib/arafetch";
+in {
+ users.users.arafetch = {
+ uid = genid "arafetch";
+ inherit home;
+ createHome = true;
+ };
+
+ systemd.services.arafetch = {
+ startAt = "Mon,Wed,Fri 09:15:00";
+ wantedBy = [ "multi-user.target" ];
+ environment = {
+ OUTDIR = home;
+ };
+ path = [ pkg pkgs.git pkgs.wget ];
+ serviceConfig = {
+ User = "arafetch";
+ WorkingDirectory = home;
+ PrivateTmp = true;
+ ExecStart = pkgs.writeDash "start-weekrun" ''
+ set -x
+ weekrun || echo "weekrun failed!"
+ find $OUTDIR/db -name \*.json | while read path;do
+ file=''${path##*/}
+ cantine=''${file%%.json}
+ ara2influx $path --cantine $cantine --host wbob.r
+ done
+ '';
+ };
+ };
+}